MCPcopy Create free account
hub / github.com/MITK/MITK / ParseJsonValue

Function ParseJsonValue

Modules/CppMicroServices/src/usModuleManifest.cpp:31–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29 void ParseJsonArray(const json& jsonArray, AnyVector& anyVector);
30
31 Any ParseJsonValue(const json& jsonValue)
32 {
33 if (jsonValue.is_object())
34 {
35 Any any = AnyMap();
36 ParseJsonObject(jsonValue, ref_any_cast<AnyMap>(any));
37 return any;
38 }
39 else if (jsonValue.is_array())
40 {
41 Any any = AnyVector();
42 ParseJsonArray(jsonValue, ref_any_cast<AnyVector>(any));
43 return any;
44 }
45 else if (jsonValue.is_string())
46 {
47 return Any(jsonValue.get<std::string>());
48 }
49 else if (jsonValue.is_boolean())
50 {
51 return Any(jsonValue.get<bool>());
52 }
53 else if (jsonValue.is_number_integer())
54 {
55 return Any(jsonValue.get<int>());
56 }
57 else if (jsonValue.is_number_float())
58 {
59 return Any(jsonValue.get<double>());
60 }
61
62 return Any();
63 }
64
65 void ParseJsonObject(const json& jsonObject, AnyMap& anyMap)
66 {

Callers 2

ParseJsonObjectFunction · 0.85
ParseJsonArrayFunction · 0.85

Calls 3

ParseJsonObjectFunction · 0.85
ParseJsonArrayFunction · 0.85
AnyClass · 0.70

Tested by

no test coverage detected