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

Function jsonValueByPath

libsolutil/JSON.cpp:170–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168}
169
170std::optional<Json> jsonValueByPath(Json const& _node, std::string_view _jsonPath)
171{
172 if (!_node.is_object() || _jsonPath.empty())
173 return {};
174
175 std::string memberName = std::string(_jsonPath.substr(0, _jsonPath.find_first_of('.')));
176 if (!_node.contains(memberName))
177 return {};
178
179 if (memberName == _jsonPath)
180 return _node[memberName];
181
182 return jsonValueByPath(_node[memberName], _jsonPath.substr(memberName.size() + 1));
183}
184
185} // namespace solidity::util

Callers 1

extractTestsFromASTMethod · 0.85

Calls 3

emptyMethod · 0.45
containsMethod · 0.45
sizeMethod · 0.45

Tested by 1

extractTestsFromASTMethod · 0.68