MentDB, The digital brain.  About us Home
Back / All functions / JSON

You also have MQL functions to handle JSON in memory.

json loadjson showjson load processjson load selectjson load by refjson iobjectjson countjson selectjson is objectjson is arrayjson existjson docjson fieldsjson iarrayjson iarrayjson uarrayjson uobjectjson darrayjson dobjectjson unloadjson unload_all

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 process

Description

    To load a json string from the process tab

admin
json load process
mentdb
1

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
{
"c": 7.0
}
admin
json uobject "newKeyId" / c 8 NUM;
json select "newKeyId" /c;
mentdb
8.0
admin
json doc "keyId";
mentdb
{
"a": 5.0,
"b": {
"c": 8.0
}
}

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|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
{
"a": 5.0,
"b": {
"c": 8.0
},
"tab": []
}

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
[
"a",
"b",
"tab"
]

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|STR|BOOL|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
{
"a": 5.0,
"b": {
"c": 8.0
},
"tab": [
"test",
"test2"
]
}

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|STR|BOOL|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
{
"a": 5.0,
"b": {
"c": 8.0
},
"tab": [
"test",
"test",
"test2",
"test2"
]
}

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|STR|BOOL|ARRAY|OBJ) - string - required
admin
json uarray "keyId" /tab 1 test2 STR
mentdb
1
admin
json doc "keyId"
mentdb
{
"a": 5.0,
"b": {
"c": 8.0
},
"tab": [
"test",
"test2",
"test2",
"test2"
]
}

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|STR|BOOL|ARRAY|OBJ) - string - required
admin
json uobject "keyId" / a 8 NUM
mentdb
1
admin
json doc "keyId"
mentdb
{
"a": 8.0,
"b": {
"c": 8.0
},
"tab": [
"test",
"test2",
"test2",
"test2"
]
}

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
{
"a": 8.0,
"b": {
"c": 8.0
},
"tab": [
"test2",
"test2",
"test2"
]
}

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
{
"b": {
"c": 8.0
},
"tab": [
"test2",
"test2",
"test2"
]
}

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 - 2018 - Innov-AI.