read
Reads a JSON stream or file and puts its content in the data item associated with the JSONStream object.
Format 1
void read ( Json-Source ) |
Format 2
void read ( Json-Source, encoding ) |
Syntax rules
1. encoding is a string literal or data item that specifies the character set to be used while parsing the JSON stream. It accepts the same values as the
iscobol.encoding * configuration property.
General rules
1. Json-Source refers to a regular disk file.
2. When the read method is invoked, the whole content of Json-Source is read and the data item associated with the JSONStream object is updated.
NOTE - If the number of occurrences of a JSON field is not known at the time the program is written, specifying the
DYNAMIC phrase of the
OCCURS clause in the data item associated with the JSONStream object is recommended.
Code example
... configuration section. repository. class jsonStream as "com.iscobol.rts.JSONStream" . ... working-storage section. ... 77 objJsonStream object reference jsonStream. ... procedure division. ... objJsonStream:>read("Sample.json") ... |