Commit e533086
Json5ProtocolReader (1): Implement main functionalities
Summary:
# Json5ProtocolReader
**JSON/JSON5 deserialization for Thrift values.**
`Json5ProtocolReader` provides a Thrift protocol reader interface that parses JSON5 or "basic" JSON input:
* **"JSON5"** refers to the "JSON5 Data Interchange Format (version 1.0.0/March 2018)" as defined in [spec.json5.org](https://spec.json5.org/). It is a subset of ECMAScript 5.1 ([262.ecma-international.org/5.1](https://262.ecma-international.org/5.1/)).
* **"Basic JSON"** refers to the "JavaScript Object Notation (JSON) Data Interchange Format" as defined in RFC7159 ([datatracker.ietf.org/doc/html/rfc7159](https://datatracker.ietf.org/doc/html/rfc7159)).
The API of this class is modeled after `SimpleJSONProtocolReader`.
## Current status
> **EXPERIMENTAL:** The output is unstable and there are missing features. APIs may break with no prior notice. USE AT YOUR OWN RISK (preferably NOT IN PRODUCTION).
## Compatibility Features
To support backward compatibility with existing JSON formats, this reader accepts multiple input formats for certain types:
### Bool Fields
- Accepts both true/false bare literals and quoted strings: `true`, `"true"`
### Integer Fields
* Accepts both JSON numbers and quoted strings: `42` and `"42"`
### Floating-Point Fields
* Accepts both JSON numbers and quoted strings: `3.14` and `"3.14"`
* Supports NaN and Infinity as bare literals or quoted: `NaN`, `"NaN"`, `Infinity`, `"Infinity"`, `-Infinity`, `"-Infinity"`
## Unimplemented types
* Enum
* Map
Reviewed By: iahs
Differential Revision: D95174817
fbshipit-source-id: 327ca0baed959c3a8fef07d48d063f3fc18967631 parent 09b9e87 commit e533086
1 file changed
+1
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
| 121 | + | |
121 | 122 | | |
122 | 123 | | |
123 | 124 | | |
| |||
0 commit comments