New in version 6.1.0: See the new features.

JSON/XML functions

The idea is to easily allow sage/srep programs to read/write JSON/XML files/channels from/to a !record structure.

read_json_values()

Read the JSON content into a !record

write_json_values()

Write the JSON content from a !record

read_xml_values()

Read the XML content into a !record

write_xml_values()

Write the XML content from a !record

Note

New in version 6.2.0: See the new features.

  • With the nested record and record arrays features, nested objects and array of objects are supported in all the JSON/XML handling routines.

  • A sequential file can be used in place of a file name to read/write JSON/XML content from a socket, pipe or previously opened sequential file.

  • To address the problem of reading/writting a json/xml tag which happens to be a Sculptor reserved word (creating a field on a record with that name is not possible). It’s possible to define the reserved word with an underscore “_” in front of it. Not clashing with the reserved word any more. As a rule, when writting/reading the first “_” will be removed (if an underscore is needed just add one more). E.g:

    !record Rec {
        _image,,a64
    }
    
  • All the JSON/XML read/write functions treat an ASCII or binary array with a “p” (packed flag) flag as one big field, so that large JSON/XML fields can be read/write. E.g.:

    !record Rec {
        large8kDataString,,a128[64],,p
    }