Json5.decode

You're seeing just the function decode, go back to Json5 module for more information.
Link to this function

decode(text, opts \\ [])

View Source

parse json5 input as elixir type.

To keep the precision of the given numbers the integers and floats are cast to Decimal

options:

  • object_key_function: (binary) -> any
    • use given function to format the object key
  • object_key_existing_atom: boolean
  • object_key_atom: boolean
    • format the object key with String.to_atom/1
    • if none of the above options are set return the key as a binary (String.t())
  • object_new_function: ({any, any}) -> any
    • function to create a map from the list of parsed tuples, by default uses Map.new/1
  • backend: [Json5.Decode.Backend.Combine, Json5.Decode.Backend.Yecc]
    • select the backend to be used (Defaults to Combine).
    • The Combine backend is coded with the json5 spec (with unicode) in mind, but a lot slower (about 2000x slower than Jason)
    • The Yecc backend is a lot faster (about 6x slower than Jason) but not that rigorous based on the json5 spec. It is just written to make the existing tests work.
iex> Json5.decode("{array: [1, 2, 3], map: {'null': null, test: 1, }, }")
{:ok, %{
  "map" => %{
    "test" => Decimal.new(1), 
    "null" => nil
  }, 
  "array" => [
    Decimal.new(1), 
    Decimal.new(2), 
    Decimal.new(3)
  ]
}}