Skip to content

Commit e533086

Browse files
Mizuchimeta-codesync[bot]
authored andcommitted
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: 327ca0baed959c3a8fef07d48d063f3fc1896763
1 parent 09b9e87 commit e533086

File tree

1 file changed

+1
-0
lines changed
  • third-party/thrift/src/thrift/lib/cpp2/protocol

1 file changed

+1
-0
lines changed

third-party/thrift/src/thrift/lib/cpp2/protocol/Protocol.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ struct SkipNoopString {
118118
void append(const char*, size_t) {}
119119
void clear() {}
120120
void reserve(size_t) {}
121+
void operator=(std::string_view) {}
121122
};
122123

123124
// Checks if bool hold a valid value (true or false) and throws exception

0 commit comments

Comments
 (0)