Skip to content

Example uses single quotes in erb and does not produce valid JSON #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
shadowbq opened this issue Sep 2, 2010 · 0 comments
Open

Comments

@shadowbq
Copy link

shadowbq commented Sep 2, 2010

<% @objects.each do |object| %>
['<%= link_to(object.user.name, user) %>',
'<%= object.description || "-" %>',
'<%= object.created_at %>'
],

extracted.. "By far the most common error I’ve encountered relates to object keys. In JSON (unlike in JavaScript) these MUST be double-quoted strings. In fact, ALL strings in JSON must be enclosed in double quotes (JavaScript also allows single quotes; JSON does not)."

Valid:

{ "name": "Simon" }

Invalid:

{ name: "Simon" }
{ 'name': "Simon" }
{ "name": 'Simon' }
http://simonwillison.net/2006/oct/11/json/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant