MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / parseJSON

Function parseJSON

src/Storages/StorageFuzzJSON.cpp:159–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

157}
158
159std::shared_ptr<JSONNode> parseJSON(const String & json)
160{
161 ParserImpl::Element document;
162 ParserImpl p;
163
164 if (!p.parse(json, document))
165 {
166 constexpr size_t max_length = 128LU;
167 throw Exception(
168 ErrorCodes::INCORRECT_DATA,
169 "Failed to parse JSON from the string '{}'{}.",
170 escapeString(json.substr(0, max_length)),
171 json.size() >= max_length ? "... (truncated)" : "");
172 }
173
174 auto root = std::make_shared<JSONNode>();
175 traverse(document, root);
176 return root;
177}
178
179char generateRandomCharacter(pcg64 & rnd, const std::string_view & charset)
180{

Callers 1

readMethod · 0.85

Calls 5

escapeStringFunction · 0.85
traverseFunction · 0.85
ExceptionClass · 0.50
parseMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected