michalmuskala / jason

A blazing fast JSON parser and generator in pure Elixir.
Other
1.61k stars 170 forks source link

Syntax error reported for perfectly valid json #66

Closed cruisemaniac closed 5 years ago

cruisemaniac commented 5 years ago

For the code snippet below:

 %{id: complex.id,
      name: complex.name,
      street: complex.street,
      locality: complex.locality,
      city: complex.city,
      state: complex.state,
      pincode: complex.pincode,
      test_payload: {
        test_key: "test_value"
      }

Phoenix framework reports a syntax error before: test_key

The JSON rendered if I remove the sub section (test_payload) and directly list the test_key is valid however.

tcoopman commented 5 years ago

You need to add a % sign before the { to have a valid elixir map.

cruisemaniac commented 5 years ago

what a royal doofus I was! Thanks for this. Not a bug!

Closing.