31 using json = nlohmann::json;
37 const json responseJson = json::parse( aJson.utf8_string() );
40 if( !responseJson.is_object() )
43 result.m_Success = responseJson.value(
"success",
false );
45 if( !
result.m_Success || !responseJson.contains(
"matches" ) || !responseJson[
"matches"].is_array() )
51 const json& matches = responseJson[
"matches"];
53 result.m_MatchingNames.reserve( matches.size() );
55 for(
const json& match : matches )
57 if( match.is_string() )
58 result.m_MatchingNames.emplace_back( wxString::FromUTF8( match.get<std::string>() ) );
61 result.m_IsLimited = responseJson.value(
"limited",
false );
63 catch(
const std::exception& )
65 result.m_MatchingNames.clear();
IFACE KIFACE_BASE kiface("pcb_test_frame", KIWAY::FACE_PCB)
wxString result
Test unit parsing edge cases and error handling.