MCPcopy Create free account
hub / github.com/argotorg/solidity / jsonParseStrict

Function jsonParseStrict

libsolutil/JSON.cpp:141–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139}
140
141bool jsonParseStrict(std::string const& _input, Json& _json, std::string* _errs /* = nullptr */)
142{
143 try
144 {
145 _json = Json::parse(
146 // TODO: remove this in the next breaking release?
147 escapeNewlinesAndTabsWithinStringLiterals(_input),
148 /* callback */ nullptr,
149 /* allow exceptions */ true,
150 /* ignore_comments */true
151 );
152 return true;
153 }
154 catch (Json::parse_error const& e)
155 {
156 if (_errs)
157 {
158 std::stringstream escaped;
159 for (char c: removeNlohmannInternalErrorIdentifier(e.what()))
160 if (std::isprint(c))
161 escaped << c;
162 else
163 escaped << "\\x" + toHex(static_cast<uint8_t>(c));
164 *_errs = escaped.str();
165 }
166 return false;
167 }
168}
169
170std::optional<Json> jsonValueByPath(Json const& _node, std::string_view _jsonPath)
171{

Callers 15

isValidMetadataFunction · 0.85
runCompilerMethod · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85
Assembler.cppFile · 0.85
compileFunction · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85
compileFunction · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85

Calls 6

toHexFunction · 0.85
whatMethod · 0.80
strMethod · 0.80
parseFunction · 0.50

Tested by 1