PEL: Use ordered_json parse on plugin data
When calling parse() to parse JSON data from a string, if the JSON is a
dictionary and the key order needs to be preserved, then the code needs
to call ordered_json::parse() instead of the standard json::parse().
This would get used when parsing the JSON string returned from PEL SRC
or UserData plugin modules.
I also changed it on the from_cbor() call since that was being saved in
an ordered_json object.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I1ac27698320f839d12d2ac45de1e4fe303cefc0d
diff --git a/extensions/openpower-pels/user_data_json.cpp b/extensions/openpower-pels/user_data_json.cpp
index 4e15284..791c39c 100644
--- a/extensions/openpower-pels/user_data_json.cpp
+++ b/extensions/openpower-pels/user_data_json.cpp
@@ -128,7 +128,7 @@
cborData.resize(data.size() - sizeof(pad) - pad);
}
- orderedJSON json = nlohmann::json::from_cbor(cborData);
+ orderedJSON json = orderedJSON::from_cbor(cborData);
return prettyJSON(componentID, subType, version, json);
}
@@ -207,7 +207,7 @@
{
std::string jsonString{data.begin(), data.begin() + data.size()};
- orderedJSON json = nlohmann::json::parse(jsonString);
+ orderedJSON json = orderedJSON::parse(jsonString);
return prettyJSON(componentID, subType, version, json);
}
@@ -309,7 +309,7 @@
const char* output = PyBytes_AS_STRING(pBytes);
try
{
- orderedJSON json = nlohmann::json::parse(output);
+ orderedJSON json = orderedJSON::parse(output);
return prettyJSON(componentID, subType, version, json);
}
catch (std::exception& e)