JSON
You also have MQL functions to handle JSON in memory.
json load <key> <jsonString>
Description
To load a json string
Parameters
key: The key - string - required
jsonString: The JSON string - string - required
admin
json load "keyId" "{}";
mentdb
1
json show
Description
To show all JSON object saved into the session
admin
json show;
mentdb
["keyId","newKeyId"]
json load select <key> <jsonString> <jPath>
Description
To load a json string and select an element
Parameters
key: The key - string - required
jsonString: The JSON string - string - required
jPath: The JSON path - string - required
admin
json load select "keyId" "{\"a\": 5.0, \"b\": {\"c\": 7.0}}" /a;
mentdb
5.0
json load by ref <fromKey> <jPath> <new KeyId>
Description
To load by ref a json string from another json object
Parameters
fromKey: The key - string - required
jPath: The JSON path - string - required
new KeyId: The JSON string - string - required
admin
json load by ref "keyId" /b "newKeyId";
mentdb
{<br> "c": 7.0<br>}
admin
json uobject "newKeyId" / c 8 NUM;<br>json select "newKeyId" /c;
mentdb
8.0
admin
json doc "keyId";
mentdb
{<br> "a": 5.0,<br> "b": {<br> "c": 8.0<br> }<br>}
json iobject <key> <jPath> <fieldname> <value> <type>
Description
To insert an element into an object in a node
Parameters
key: The key - string - required
jPath: The JSON path - string - required
fieldname: The fieldname - string - required
value: The value - string - required
type: The type (NUM|INT|STR|BOOL|BOOL2|ARRAY|OBJ) - string - required
admin
json iobject "keyId" / a 5 NUM;
mentdb
1
admin
json iobject "keyId" / tab "[]" ARRAY;
mentdb
1
json count <key> <jPath>
Description
To count element in a node
Parameters
key: The key - string - required
jPath: The JSON path - string - required
admin
json count "keyId" /
mentdb
3
json select <key> <jPath>
Description
To select an element in a node
Parameters
key: The key - string - required
jPath: The JSON path - string - required
admin
json select "keyId" /a
mentdb
5.0
json is object <key> <jPath>
Description
To check if an element is an object in a node
Parameters
key: The key - string - required
jPath: The JSON path - string - required
admin
json is object "keyId" /
mentdb
1
json is array <key> <jPath>
Description
To check if an element is an array in a node
Parameters
key: The key - string - required
jPath: The JSON path - string - required
admin
json is array "keyId" /tab
mentdb
1
json exist <key>
Description
To check if a key is loaded
Parameters
key: The key - string - required
admin
json exist "keyId"
mentdb
1
json doc <key>
Description
To get a json document
Parameters
key: The key - string - required
admin
json doc "keyId"
mentdb
{<br> "a": 5.0,<br> "b": {<br> "c": 8.0<br> },<br> "tab": []<br>}
json fields <key> <jPath>
Description
To get all fields into an object in a node
Parameters
key: The key - string - required
jPath: The JSON path - string - required
admin
json fields "keyId" /
mentdb
[<br> "a",<br> "b",<br> "tab"<br>]
json iarray <key> <jPath> <value> <type>
Description
To insert an element into an array in a node
Parameters
key: The key - string - required
jPath: The JSON path - string - required
value: The value - string - required
type: The type (NUM|INT|STR|BOOL|BOOL2|ARRAY|OBJ) - string - required
admin
json iarray "keyId" /tab test STR;
mentdb
1
admin
json iarray "keyId" /tab test2 STR
mentdb
1
admin
json doc "keyId"
mentdb
{<br> "a": 5.0,<br> "b": {<br> "c": 8.0<br> },<br> "tab": [<br> "test",<br> "test2"<br> ]<br>}
json iarray <key> <jPath> <index> <value> <type>
Description
To insert an element into an array in a node
Parameters
key: The key - string - required
jPath: The JSON path - string - required
index: The index position - number - required
value: The value - string - required
type: The type (NUM|INT|STR|BOOL|BOOL2|ARRAY|OBJ) - string - required
admin
json iarray "keyId" /tab 0 test STR;
mentdb
1
admin
json iarray "keyId" /tab test2 STR
mentdb
1
admin
json doc "keyId"
mentdb
{<br> "a": 5.0,<br> "b": {<br> "c": 8.0<br> },<br> "tab": [<br> "test",<br> "test",<br> "test2",<br> "test2"<br> ]<br>}
json uarray <key> <jPath> <index> <value> <type>
Description
To update an element into an array in a node
Parameters
key: The key - string - required
jPath: The JSON path - string - required
index: The index - integer - required
value: The value - string - required
type: The type (NUM|INT|STR|BOOL|BOOL2|ARRAY|OBJ) - string - required
admin
json uarray "keyId" /tab 1 test2 STR;
mentdb
1
admin
json doc "keyId"
mentdb
{<br> "a": 5.0,<br> "b": {<br> "c": 8.0<br> },<br> "tab": [<br> "test",<br> "test2",<br> "test2",<br> "test2"<br> ]<br>}
json uobject <key> <jPath> <fieldname> <value> <type>
Description
To update an element into an object in a node
Parameters
key: The key - string - required
jPath: The JSON path - string - required
fieldname: The fieldname - string - required
value: The value - string - required
type: The type (NUM|INT|STR|BOOL|BOOL2|ARRAY|OBJ) - string - required
admin
json uobject "keyId" / a 8 NUM;
mentdb
1
admin
json doc "keyId"
mentdb
{<br> "a": 8.0,<br> "b": {<br> "c": 8.0<br> },<br> "tab": [<br> "test",<br> "test2",<br> "test2",<br> "test2"<br> ]<br>}
json darray <key> <jPath> <index>
Description
To delete an element from an array in a node
Parameters
key: The key - string - required
jPath: The JSON path - string - required
index: The index - integer - required
admin
json darray "keyId" /tab 0;
mentdb
1
admin
json doc "keyId"
mentdb
{<br> "a": 8.0,<br> "b": {<br> "c": 8.0<br> },<br> "tab": [<br> "test2",<br> "test2",<br> "test2"<br> ]<br>}
json dobject <key> <jPath> <fieldname>
Description
To delete an element from an object in a node
Parameters
key: The key - string - required
jPath: The JSON path - string - required
fieldname: The fieldname - string - required
admin
json dobject "keyId" / a;
mentdb
1
admin
json doc "keyId"
mentdb
{<br> "b": {<br> "c": 8.0<br> },<br> "tab": [<br> "test2",<br> "test2",<br> "test2"<br> ]<br>}
json unload <key>
Description
To unload a json document
Parameters
key: The key - string - required
admin
json unload "keyId";
mentdb
1
json unload_all
Description
To unload all json documents
admin
json unload_all;
mentdb
1
© 2012 - 2023