Skip to content

Handling of exceptional floats #204

Description

@oandrieu

Not really a fan of the recent change with the handling of floats.

There's now a disconnect between the handling in the readers and writers, with the reader having no problem creating a value that will be rejected by the writer.

For instance, this now crashes:

let () =
  "[ 1e999 ]"
  |> Yojson.Safe.from_string
  |> Yojson.Safe.to_string
  |> print_endline

Granted, it wasn't round-tripping before, but at least it went from a valid JSON document to another valid JSON document.

I get the idea of making the std flag the default, but there's merit to the old approach of printing "infinity".

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions