JSONUtil Embedded Objects
A JSONUtil embedded object provides JSON object methods.
Methods
Method |
Description |
---|---|
Object parse(String jsonStr) |
Converts a JSON character string into an object. |
String toString(Object jsonObject) |
Converts an object to a JSON character string. |
Object path(String jsonStr,String jsonPath) |
Returns the field value in a path specified by the JSON character string. This method is similar to XPath and can be used to retrieve or set JSON by path. You can use . or [] in the path to access members and values. For example, tables[0].table_name. |
Example
The content of variable str is as follows:
{ "cities": [{ "name": "Shenzhen", "areaCode": "0755" }, { "name": "city2", "areaCode": "010" }, { "name": "Shanghai", "areaCode": "021" }] }
The expression for obtaining the area code of Shenzhen is as follows:
#{JSONUtil.path(str,"cities[0].areaCode")}
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot