func X3.EN_JSON_SET_VALUE(Clbfile JSON_OUT, Char KEY_IN, Char TYPE_IN, Clbfile VALUE_IN) : Tinyint

Add or modify a key and a value to a Json

  • JSON_OUT Clbfile : Original Json and returned modified
  • KEY_IN Char : Key to insert / update
  • TYPE_IN Char : Type of data to insert:
    • b : boolean (true, false)
    • a : alphanumeric (SageX3, L.V. expertise X3)
    • n : numeric (10, 1.23)
    • d : date (YYYY-MM-DDThh:mm:ssZ)
    • c : collection ([{},{}])
    • t : array (["",""])
    • j : json ({...})
    • o : BinData
    • i : ObjectId
    • u : NumberInt
    • z : not determined (not found or null)
  • VALUE_IN Clbfile : The value to insert in one of the following formats:
    • Strings : string > "string"
    • Dates : 2021-01-16T21:42:42.132Z : "ISODate("2021-01-16T21:42:42.132Z")"
    • Numerics : 2.30 > 2.30
    • Booleans : true > true
    • Collections : [{},{}] > [{},{}]
    • Json : {} > {}
    • Null : null > null
    • ObjectId : 123456789 > ObjectId("123456789")
Return Tinyint 1 if OK and 0 if not
Example

# Adding an Alphanumeric "test" key with the value "my value" in a Json flow contained in the Clob [L]JSON
Local Clbfile JSON(8)
If func X3.EN_JSON_SET_VALUE([L]JSON, "test", "a", "my value")
Infbox "Added"
Else
Infbox "Error : " + GX3ERR
Endif