TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

JSON: The JavaScript subset that isn't

4 pointsby experiment0over 12 years ago

1 comment

bartlover 12 years ago
Yawn. JSON isn't valid Javascript, but it sure is a valid Javascript data structure.<p>I often use code like<p><pre><code> echo "var d = ", json_encode($data), ";\n"; </code></pre> and be 100% sure I'm generating perfectly valid Javascript, no matter what is in $data. (Well, apart from circular references, and "resources".)
评论 #5016283 未加载