Records Package
The SparForte built-in records package provides subprograms to manipulate
record variables or types.
GCC Ada Equivalent : n/a
records.to_json( s, a )
Encode the record contents as a JSON string.
Example
type rt is record s : string; end record;
r : rt;
r.s := "foo";
records.to_json( j, r ); -- j is {"s":"foo"}
Parameters
Param
Mode
Type
Default
Description
s
out
string
required
the JSON expression
r
in
a record type
required
the record to get values from
Exceptions
For more details and exceptions, see the Reference Manual section
JSON and SparForte Types .
See Also
arrays.to_array arrays.to_json records.to_record strings.to_string strings.to_json
Compare With
Ada: N/A PHP: json_encode
records.to_record( r, s )
Decode a JSON string, storing the values in the record.
Example
type rt is record s : string; end record;
r : rt;
r.s := "{" & ASCII.Quotation & "s" & ASCII.Quotation &
":" & ASCII.Quotation & "foo" & ASCII.Quotation & "}";
records.to_record( r, s ); -- r.s is "foo"
Parameters
Param
Mode
Type
Default
Description
r
out
a record type
required
the record to assign values to
s
in
string
required
the JSON expression
Exceptions
For more details and exceptions, see the Reference Manual section
JSON and SparForte Types .
See Also
arrays.to_array arrays.to_json records.to_json strings.to_string strings.to_json
Compare With
Ada: N/A PHP: json_decode