JSON — version history
A non-visual object that builds a JSON document type by type, reads it along a path and edits it in place, in pure PowerScript — no page, no engine, free in every edition. Introduced in 3.0.
4.0 — October 2026 #
New #
decimalandlonglongoverloads ofof_set_numberandof_add_number, and the readersof_get_decimalandof_get_longlong: an amount keeps all its digits (690.50is written690.5), an identifier of more than 15 digits reads back exactly.- Building an array with thousands of
of_add_*calls in a row is fast: 2,000 rows in a few tens of milliseconds, where 3.0 took several minutes. - Reading or editing a large document (an 80 KB API response, 2,000 rows) takes time proportional to its size: reading rows one by one (
rows/1,rows/2…) or walking keys withof_nameno longer starts over from the beginning (of_counttook 20 s on such a document). of_loadignores a leading BOM (a UTF-8 file saved with a BOM).- The documentation states two rules that do not change: a null string is written
""(for a JSONnull, useof_set_raw(path, "null")), and a key written twice is read at its first occurrence. of_get_array(as_path, as_values[]): every element of an array in one call, each one read asof_get_stringreads it (a string decoded, an object or an array as its JSON); it returns the number of elements,-4when there is no array there.of_pretty(al_indent): the document indented with that many spaces per level, or compact on one line with0— the smallest text to store or send;of_pretty()keeps the tabs.
Fixed #
- A null value given to
of_set_number,of_add_number,of_set_boolean,of_add_boolean, or a null or empty value given toof_set_raw/of_add_raw, writesnulland leaves the rest of the document intact (the whole document became null or stopped being JSON; a null boolean was writtenfalse). - Writing into a loaded document whose keys are written
"k" : v, contain an escaped character or are followed by a line break, or whose root is an array, replaces or adds the value as on a built document (the key was duplicated, or the write wrongly returned-4);of_set_membersreturns-4when the root is not an object instead of replacing the document with the fragment. of_set_*("items/1/qty", …)adds a new key to an object placed in an array (it returned-4); an array is crossed by an existing index, only object keys are created.- A path with an empty segment (
/name,a//b,a/) returns-5and writes nothing (keys named""were created, andof_removecould remove another value); readers answer "absent". of_loadrefuses a badly written number (-,01,+1,.5,1.,1e) with-4, andof_is_validis false (they were accepted).of_get_numberresolves exponents (2.5E+3was read 2.5,1E-0000005gave 0) and keeps 17 significant digits (decimals were cut at 9).of_loadof a document nested more than 512 levels deep returns-4and the application stays alive.of_set_numberandof_add_numberwrite a decimal point whatever the machine's decimal separator (only a comma was converted).- Strings read by any component decode
\band\f; a\ufollowed by four characters that are not hexadecimal is kept as written.
Behavior changes #
- Array indexes in a path count from 1, like every position in the library:
lines/1is the first line;lines/0designates nothing — a read reports it absent, a write returns-5. A loopfor i = 0 to n - 1over"lines/" + String(i)becomesfor i = 1 to n. of_loadof a text made only of blanks (line breaks, tabs) returns-5, like an empty text (it returned-4): test< 0to recognise an empty or invalid file.- See the 3 → 4 migration guide, sections 11.3, 11.6, 11.32 and 11.42.
3.0 — September 2026 #
New #
- First release: one object to build (
of_set_string,of_set_number,of_set_boolean,of_set_raw,of_set_array,of_set_members, andof_add_*to feed an array; missing levels of a path are created as objects) and to read (of_load, thenof_get_string,of_get_number,of_get_boolean,of_type,of_count,of_name,of_exists,of_is_valid) along a path of levels joined by/. - In-place editing of a loaded document (
of_set_*,of_remove),of_text()for the compact text andof_pretty()for an indented one,of_clear()to start again. - Every method that writes returns a
long(0,-5invalid argument,-4malformed document). - A free component: it needs no license key and has no demo limit.