Is there a ready-made M function that stores a json string as a
multi-level global?
Is there a ready-made M function that stores a json string as aThere's no Standard M function that would do that.
multi-level global?
What implementation are you running on?
I use YottaDB.
Any M function that works well will suit me
Is there a ready-made M function that stores a json string as a >multi-level global?There's no Standard M function that would do that.
What implementation are you running on?
On Monday, November 1, 2021 at 3:25:37 PM UTC-4, suka...@gmail.com wrote:
I use YottaDB.
Any M function that works well will suit me
The function atI use YottaDB.
Any M function that works well will suit me
https://github.com/lparenteau/DataBallet/blob/master/r/json.m
worked good for me...
Jens
BTW the fact that there is a one-to-one correspondence between JSON (and XML) and M Globals is the heart of this set of documents:You can try this too: https://github.com/shabiel/M-Web-Server/blob/master/doc/important-utilities.md#json
https://github.com/robtweed/global_storage
and is the basis of the Node.js abstraction of Global Storage into persistent JSON/JavaScript Objects known as QEWD-JSdb:
https://github.com/robtweed/qewd-jsdb
On Wednesday, November 3, 2021 at 7:04:03 AM UTC-6, rtweed wrote:
BTW the fact that there is a one-to-one correspondence between JSON (and XML) and M Globals is the heart of this set of documents:
https://github.com/robtweed/global_storage
and is the basis of the Node.js abstraction of Global Storage into persistent JSON/JavaScript Objects known as QEWD-JSdb:
https://github.com/robtweed/qewd-jsdbYou can try this too: https://github.com/shabiel/M-Web-Server/blob/master/doc/important-utilities.md#json
четверг, 4 ноября 2021 г. в 21:19:56 UTC+2, Sam Habiel:The encoder behaves differently if you start with a number (it assumes you want an array) vs not (it will assume that you want an object).
On Wednesday, November 3, 2021 at 7:04:03 AM UTC-6, rtweed wrote:
BTW the fact that there is a one-to-one correspondence between JSON (and XML) and M Globals is the heart of this set of documents:
https://github.com/robtweed/global_storage
and is the basis of the Node.js abstraction of Global Storage into persistent JSON/JavaScript Objects known as QEWD-JSdb:
Hello Sam !https://github.com/robtweed/qewd-jsdbYou can try this too: https://github.com/shabiel/M-Web-Server/blob/master/doc/important-utilities.md#json
Why, if numbers appear in a node, I get a different result ???
In the same example:
S X ("myObj", "booleanT") = "true"
S X ("myObj", "booleanF") = "false"
S X ("myObj", "numeric") = 3.1416
S X ("myObj", "nullValue") = "null"
S X ("myObj", "array", 1) = "one"
S X ("myObj", "array", 2) = "two"
S X ("myObj", "array", 3) = "three"
S X ("myObj", "subObject", "fieldA") = "hello"
S X ("myObj", "subObject", "fieldB") = "world"
JSON (1) = "{" myObj ": {" array ": [" one "," two "," three "]," booleanF ": false," booleanT ": true," nullValue ": null," numeric ":"
JSON (2) = "3.1416," subObject ": {" fieldA ":" hello "," fieldB ":" world "}}}"
In my case:
XX (501, "array", 1) = "one"
XX (501, "array", 2) = "two"
XX (501, "array", 3) = "three"
XX (501, "booleanF") = "false"
XX (501, "booleanT") = "true"
XX (501, "nullValue") = "null"
XX (501, "numeric") = 3.1416
XX (501, "subObject", "fieldA") = "hello"
XX (501, "subObject", "fieldB") = "world"
JSON (1) = "{[{" array ": [" one "," two "," three "]," booleanF ": false," booleanT ": true," nullValue ": null," numeric ": 3.1416 , "
JSON (2) = "" subObject ": {" fieldA ":" hello "," fieldB ":" world "}}]}"
It happens to me that the nodes of globals contain only numbers
(codes) ...
On Thursday, November 11, 2021 at 5:20:17 AM UTC-7, gont...@gmail.com wrote:
четверг, 4 ноября 2021 г. в 21:19:56 UTC+2, Sam Habiel:
On Wednesday, November 3, 2021 at 7:04:03 AM UTC-6, rtweed wrote:
BTW the fact that there is a one-to-one correspondence between JSON (and XML) and M Globals is the heart of this set of documents:
https://github.com/robtweed/global_storage
and is the basis of the Node.js abstraction of Global Storage into persistent JSON/JavaScript Objects known as QEWD-JSdb:
Hello Sam !https://github.com/robtweed/qewd-jsdbYou can try this too: https://github.com/shabiel/M-Web-Server/blob/master/doc/important-utilities.md#json
Why, if numbers appear in a node, I get a different result ???
In the same example:
S X ("myObj", "booleanT") = "true"
S X ("myObj", "booleanF") = "false"
S X ("myObj", "numeric") = 3.1416
S X ("myObj", "nullValue") = "null"
S X ("myObj", "array", 1) = "one"
S X ("myObj", "array", 2) = "two"
S X ("myObj", "array", 3) = "three"
S X ("myObj", "subObject", "fieldA") = "hello"
S X ("myObj", "subObject", "fieldB") = "world"
JSON (1) = "{" myObj ": {" array ": [" one "," two "," three "]," booleanF ": false," booleanT ": true," nullValue ": null," numeric ":"
JSON (2) = "3.1416," subObject ": {" fieldA ":" hello "," fieldB ":" world "}}}"
In my case:The encoder behaves differently if you start with a number (it assumes you want an array) vs not (it will assume that you want an object).
XX (501, "array", 1) = "one"
XX (501, "array", 2) = "two"
XX (501, "array", 3) = "three"
XX (501, "booleanF") = "false"
XX (501, "booleanT") = "true"
XX (501, "nullValue") = "null"
XX (501, "numeric") = 3.1416
XX (501, "subObject", "fieldA") = "hello"
XX (501, "subObject", "fieldB") = "world"
JSON (1) = "{[{" array ": [" one "," two "," three "]," booleanF ": false," booleanT ": true," nullValue ": null," numeric ": 3.1416 , "
JSON (2) = "" subObject ": {" fieldA ":" hello "," fieldB ":" world "}}]}" :
It happens to me that the nodes of globals contain only numbers
(codes) ...
--Sam
четверг, 11 ноября 2021 г. в 16:49:31 UTC+2, Sam Habiel:
On Thursday, November 11, 2021 at 5:20:17 AM UTC-7, gont...@gmail.com wrote:
четверг, 4 ноября 2021 г. в 21:19:56 UTC+2, Sam Habiel:
On Wednesday, November 3, 2021 at 7:04:03 AM UTC-6, rtweed wrote:
BTW the fact that there is a one-to-one correspondence between JSON (and XML) and M Globals is the heart of this set of documents:
https://github.com/robtweed/global_storage
and is the basis of the Node.js abstraction of Global Storage into persistent JSON/JavaScript Objects known as QEWD-JSdb:
Hello Sam !https://github.com/robtweed/qewd-jsdbYou can try this too: https://github.com/shabiel/M-Web-Server/blob/master/doc/important-utilities.md#json
Why, if numbers appear in a node, I get a different result ???
In the same example:
S X ("myObj", "booleanT") = "true"
S X ("myObj", "booleanF") = "false"
S X ("myObj", "numeric") = 3.1416
S X ("myObj", "nullValue") = "null"
S X ("myObj", "array", 1) = "one"
S X ("myObj", "array", 2) = "two"
S X ("myObj", "array", 3) = "three"
S X ("myObj", "subObject", "fieldA") = "hello"
S X ("myObj", "subObject", "fieldB") = "world"
JSON (1) = "{" myObj ": {" array ": [" one "," two "," three "]," booleanF ": false," booleanT ": true," nullValue ": null," numeric ":"
JSON (2) = "3.1416," subObject ": {" fieldA ":" hello "," fieldB ":" world "}}}"
In my case:The encoder behaves differently if you start with a number (it assumes you want an array) vs not (it will assume that you want an object).
XX (501, "array", 1) = "one"
XX (501, "array", 2) = "two"
XX (501, "array", 3) = "three"
XX (501, "booleanF") = "false"
XX (501, "booleanT") = "true"
XX (501, "nullValue") = "null"
XX (501, "numeric") = 3.1416
XX (501, "subObject", "fieldA") = "hello"
XX (501, "subObject", "fieldB") = "world"
JSON (1) = "{[{" array ": [" one "," two "," three "]," booleanF ": false," booleanT ": true," nullValue ": null," numeric ": 3.1416 , "
JSON (2) = "" subObject ": {" fieldA ":" hello "," fieldB ":" world "}}]}"
:
It happens to me that the nodes of globals contain only numbers
(codes) ...
--SamI'm testing a Rob Tweed encoder
Get a different result:
s aa = $$ arrayToJSON ^% zewdJSON ("XX") aa="{"501":{"array":["one","two","three"],"booleanF":false,"booleanT":true,"nullValue":"null","numeric":3.1416,"subObject":{"fieldA":"hello","fieldB":"world"}}}"
What were you expecting the JSON representation of your Global contents to be? My encoder is producing exactly what I'd have expectedThere are cases in old M implementations when it is necessary to return more than 32 kb to the JSON client
Rob
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 407 |
Nodes: | 16 (2 / 14) |
Uptime: | 15:23:43 |
Calls: | 8,555 |
Calls today: | 7 |
Files: | 13,219 |
Messages: | 5,925,665 |