window.ENTITIES={'/api/snippets/javascript/js%20remove%20curly%20brackets%20from%20json%20stringify':[{"result":true,"message":null,"batch":{"type":"javascript","name":"js remove curly brackets from json stringify","items":[{"id":"1eVYED","type":"javascript","name":"js remove curly brackets from json stringify","content":"const json = JSON.stringify(user);\nconst text = json.replace(/[{}]/g, '');\n\n\n// Example output:\n//\n// \"id\":1,\"name\":\"Tom\",\"age\":25","source":"","author":{"id":"dDYrga","name":"Ela-Davey","avatar":"1629139563265__dDYrga__w40px_h40px.jpg","points":663,"role":"BASIC"},"creationTime":1636489183000,"updateTime":1675626663000,"removalTime":null},{"id":"paVbgj","type":"javascript","name":"js remove curly brackets from json stringify","content":"const renderText = (object) => {\n const json = JSON.stringify(object);\n if (json[0] === '{') {\n return json.substring(1, json.length - 1);\n }\n return json;\n};\n\n\n// Usage example:\n\nconst user = {\n id: 1,\n name: 'Tom',\n age: 25\n};\n\nconst text = renderText(user);\n\nconsole.log(text); // \"id\":1,\"name\":\"Tom\",\"age\":25\n\n\n// Example output:\n//\n// \"id\":1,\"name\":\"Tom\",\"age\":25","source":"","author":{"id":"4o2mQa","name":"Kevin","avatar":"1629141224994__4o2mQa__w40px_h40px.jpg","points":797,"role":"BASIC"},"creationTime":1675627140000,"updateTime":null,"removalTime":null}]}}]};