OCLOperators JsonGetProp
Charles Olet (talk | contribs) (Created page with "The JsonGetProp operator is for JSON strings and returns the value of a JSON property as a string. Null is returned if the property is not available. The JsonGetProp operator can be chained to get a nested JSON value. ==== Example: 1 ==== '{name: "Sam"}'.JsonGetProp('name') Returns 'Samuel' ==== Example: 2 ==== <nowiki>'{person: {name: "Same", age: 25}}'.JsonGetProp('person').JsonGetProp('age')</nowiki> Returns 25") |
No edit summary |
||
(2 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
The JsonGetProp operator is for JSON strings and returns the value of a JSON property as a string. Null is returned if the property is | The JsonGetProp operator is for JSON strings and returns the value of a JSON property as a string. Null is returned if the property is unavailable. | ||
The JsonGetProp operator can be chained to get a nested JSON value. | The JsonGetProp operator can be chained to get a nested JSON value. | ||
==== Example: 1 ==== | ==== Example: 1 ==== | ||
'{name: " | '{name: "Samuel"}'.JsonGetProp('name') | ||
Returns | Returns | ||
'Samuel' | 'Samuel' | ||
==== Example: 2 ==== | ==== Example: 2 ==== | ||
<nowiki>'{person: {name: " | <nowiki>'{person: {name: "Samuel", age: 25}}'.JsonGetProp('person').JsonGetProp('age')</nowiki> | ||
Returns | Returns | ||
25 | 25 | ||
==== See also: ==== | |||
* [[Documentation:OCLOperators JSonToObjects|OCL Operator JsonToObjects]] |
Latest revision as of 05:41, 19 August 2024
The JsonGetProp operator is for JSON strings and returns the value of a JSON property as a string. Null is returned if the property is unavailable.
The JsonGetProp operator can be chained to get a nested JSON value.
Example: 1
'{name: "Samuel"}'.JsonGetProp('name')
Returns
'Samuel'
Example: 2
'{person: {name: "Samuel", age: 25}}'.JsonGetProp('person').JsonGetProp('age')
Returns
25
See also:
This page was edited 33 days ago on 08/19/2024. What links here