{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":832,"path":"api-reference/server-api-reference/JSONScopedAPI.md","title":"JSON - Scoped","bundle":null,"doc_type":null,"release":"australia","body":"\n# JSON- Scoped\n\nThe JSON script include provides scoped methods to create JSON objects from a string, and to turn JSON objects into strings.\n\nFor scoped applications, the JSON API uses static methods that call the JavaScript ES5 native JSON object.\n\n**Note:** Use the global keyword with JSON method calls in scoped scripts, for example, `global.JSON.stringify()`. Not using the global keyword could result in an error message, such as `ScopedRhinoObjectWrapper: not a wrappable type: com.glide.script.FieldGlideDescriptor`.\n\n**Parent Topic:**[Server API reference](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/api-server.md)\n\n## Scoped JSON - parse\\(String str\\)\n\nCreates an object or primitive type from a JSON formatted string.\n\n|Name|Type|Description|\n|----|----|-----------|\n|str|String|JSON formatted string.|\n\n|Type|Description|\n|----|-----------|\n|Object|Object created from the specified string.|\n\n```\nvar str = '{\"name\":\"George\",\"lastname\":\"Washington\"}';\nvar obj = global.JSON.parse(str);\ngs.info('The first name is ' + obj.name);\n```\n\nOutput:\n\n```\nThe first name is George\n```\n\n## Scoped JSON - stringify\\(Object jsonObject\\)\n\nCreates a string from a JSON object.\n\n|Name|Type|Description|\n|----|----|-----------|\n|jsonObject|Object|JSON object to turn into a string.|\n\n|Type|Description|\n|----|-----------|\n|String|JSON-formatted string.|\n\n```\nvar obj = {\"name\":\"George\",\"lastname\":\"Washington\"};\nvar str =  global.JSON.stringify(obj);\ngs.info('The object ' + str);\n```\n\nOutput:\n\n```\nThe object {\"name\":\"George\",\"lastname\":\"Washington\"}\n```\n\n"}}