[SparForte][Banner]
[Top Main Menu] Intro | Tutorials | Reference | Packages | Examples | Contributors   [Back Page]      [Next Page]  

Records Package

The SparForte built-in records package provides subprograms to manipulate record variables or types.

GCC Ada Equivalent: n/a

  to_json( s, r )       to_record( s, r )
 
Help Command: Contents of the records package

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

 
[Right Submenu]

 Summary

 arrays

 btree_io

 calendar

 cgi

 chains

 command_line

 db/ postgresql

 dbm

 directory_operations

 doubly_linked...

 dynamic_hash_...

 enums

 exceptions

 files

 gnat.cgi

 gnat.crc32

 hash_io

 lock_files

 memcache

 memcache.highread

 mysql

 mysqlm

 numerics

 os

 pen

 pen (OpenGL)

 records

 sound

 source_info

 stats

 strings

 System

 teams

 templates

 text_io

 units

[Back to Top] Back To Top [Small Forte Symbol]