TGViewer
JavaScript JavaScript @javascript · 31.1K subscribers
Post #2786 3.72K
CHALLENGE

const data = '{"name":"Sarah","age":25,"skills":["JavaScript","Python"]}'
const parsed = JSON.parse(data)
const stringified = JSON.stringify(parsed, null, 0)
const reparsed = JSON.parse(stringified)

try {
const invalid = '{name:"John","incomplete":}'
JSON.parse(invalid)
} catch (e) {
console.log(e.name)
}

console.log(typeof parsed.age)
console.log(reparsed.skills.length)
console.log(JSON.stringify({a: undefined, b: null, c: 0}))
  • ❤ 1
More from @javascript
  1. Sep 30, 2026Post #3528
  2. Sep 30, 2026CHALLENGE const message = 'a😀bc'; const codePoints = [...message]; const combined = { raw…
  3. Sep 29, 2026Post #3526
  4. Sep 29, 2026CHALLENGE const order = []; order.push('start'); setTimeout(() => { order.push('timeout');…
  5. Sep 28, 2026Post #3524
  6. Sep 28, 2026CHALLENGE let order = []; function a() { try { return 'try'; } finally { order.push('a-fin…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →