sm.json
Parses and writes json files from and to lua values.
Functions:
fileExists open parseJsonString save writeJsonString
sm.json.fileExists(path)
Checks if a json file exists at the input path
Parameters:
| Type | Name | Description |
| string | path | The json file path. |
Returns:
| Type | Description |
| boolean | Return true if the file exists. |
sm.json.open(path)
Opens a json file and parses to Lua table.
Parameters:
| Type | Name | Description |
| string | path | The json file path. |
Returns:
| Type | Description |
| table | The table. |
sm.json.parseJsonString(json)
Parses a json string to lua table.
Parameters:
| Type | Name | Description |
| string | json | The json string. |
Returns:
| Type | Description |
| table | The table. |
sm.json.save(root, path)
Write a lua table to json.
Parameters:
| Type | Name | Description |
| table | root | The lua table. |
| string | path | The json file path. |
sm.json.writeJsonString(root)
Writes a json string from a lua table.
Parameters:
| Type | Name | Description |
| string | root | The lua table. |
Returns:
| Type | Description |
| string | The json string. |