Xbasic
json_to_yaml Function
Syntax
json_to_yaml(c json)
Arguments
- jsonCharacter
A string containing the JSON to convert to YAML.
Description
Converts a JSON string to YAML.
Discussion
YAML is a markup language that is sometimes used in place of JSON. This function converts JSON to YAML. YAML (yet another markup language) uses nesting to represent hierarchy.This function is a wrapper for the Extension::JSON class.
Example
json = <<%str% { "fname": "john", "lname": "public", "children" : [ {"name": "callie","hobbies": ["minecraft","leggo"]}, {"name": "griffin","hobbies": ["ballet"]} ], "address": { "street": "12 and main", "city": "Squares Ville", "State": "KY" } } %str% ?json_to_yaml(json) fname: john lname: public children: - name: callie hobbies: - minecraft - leggo - name: griffin hobbies: - ballet address: street: 12 and main city: Squares Ville State: KY
See Also