JSON module
JSON.Decode(data)
let data = '{"name" : "Richard", "age" : 28}';
type personType = [name = 'Not specified', age = 0, occupation = 'Unemployed'];
let myPerson = JSON.Decode<personType>(data); // Person will have occupation 'Unemployed' since the key is not present in the json data
return myPerson.age; // Returns 28JSON.DecodeTable
let data = '[{"name" : "Richard", "age" : 28}, {"name" : "Samantha", "age" : 21, "occupation" : "Programmer" }]';
type personType = [name = 'Not specified', age = 0, occupation = 'Unemployed'];
let persons = JSON.DecodeTable<personType>(data);
return persons.First().name; // Will return "Richard"JSON.Encode
JSON.EncodeTable
Last updated
Was this helpful?