Json5.encode

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

encode(input, opts \\ [])

View Source

Encode elixir input as json5. Contains some simple formatting options

options:

  • pretty: boolean
  • compact: boolean
iex> Json5.encode(%{map: %{test: 1, null: nil}, array: [1,2,3]})
{:ok, "{array: [1, 2, 3], map: {'null': null, test: 1, }, }"}
iex> Json5.encode(%{map: %{test: 1, null: nil}, array: [1,2,3]}, pretty: true)
{:ok, """
  {
    array: [
      1,
      2,
      3,
    ],
    map: {
      'null': null,
      test: 1,
    },
  }
  """}
iex> Json5.encode(%{map: %{test: 1, null: nil}, array: [1,2,3]}, compact: true)
{:ok, "{array:[1,2,3],map:{'null':null,test:1}}"}