MCPcopy Create free account
hub / github.com/catboost/catboost / WriteJsonValue

Function WriteJsonValue

library/cpp/json/yson/json2yson.cpp:8–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6
7namespace NJson2Yson {
8 static void WriteJsonValue(const NJson::TJsonValue& jsonValue, NYT::TYson2JsonCallbacksAdapter* adapter) {
9 switch (jsonValue.GetType()) {
10 default:
11 case NJson::JSON_NULL:
12 adapter->OnNull();
13 break;
14 case NJson::JSON_BOOLEAN:
15 adapter->OnBoolean(jsonValue.GetBoolean());
16 break;
17 case NJson::JSON_DOUBLE:
18 adapter->OnDouble(jsonValue.GetDouble());
19 break;
20 case NJson::JSON_INTEGER:
21 adapter->OnInteger(jsonValue.GetInteger());
22 break;
23 case NJson::JSON_UINTEGER:
24 adapter->OnUInteger(jsonValue.GetUInteger());
25 break;
26 case NJson::JSON_STRING:
27 adapter->OnString(jsonValue.GetString());
28 break;
29 case NJson::JSON_ARRAY: {
30 adapter->OnOpenArray();
31 const NJson::TJsonValue::TArray& arr = jsonValue.GetArray();
32 for (const auto& it : arr) {
33 WriteJsonValue(it, adapter);
34 }
35 adapter->OnCloseArray();
36 break;
37 }
38 case NJson::JSON_MAP: {
39 adapter->OnOpenMap();
40 const NJson::TJsonValue::TMapType& map = jsonValue.GetMap();
41 for (const auto& it : map) {
42 adapter->OnMapKey(it.first);
43 WriteJsonValue(it.second, adapter);
44 }
45 adapter->OnCloseMap();
46 break;
47 }
48 }
49 }
50
51 void SerializeJsonValueAsYson(const NJson::TJsonValue& inputValue, NYson::TYsonWriter* ysonWriter) {
52 NYT::TYson2JsonCallbacksAdapter adapter(ysonWriter);

Callers 3

SerializeJsonValueAsYsonFunction · 0.85
WriteJsonValueMethod · 0.85
WriteJsonValueMethod · 0.85

Calls 15

GetTypeMethod · 0.45
OnNullMethod · 0.45
OnBooleanMethod · 0.45
GetBooleanMethod · 0.45
OnDoubleMethod · 0.45
GetDoubleMethod · 0.45
OnIntegerMethod · 0.45
GetIntegerMethod · 0.45
OnUIntegerMethod · 0.45
GetUIntegerMethod · 0.45
OnStringMethod · 0.45
GetStringMethod · 0.45

Tested by

no test coverage detected