aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tools/yql_highlight/json.cpp
blob: 114f53b9668a8275858ec020a141693ecf750fff (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "json.h"

#include <yql/essentials/utils/yql_panic.h>

#include <library/cpp/json/json_prettifier.h>
#include <library/cpp/json/json_writer.h>

#include <util/stream/str.h>

namespace NSQLHighlight {

    void Print(IOutputStream& out, const NJson::TJsonValue& json) {
        NJson::TJsonWriterConfig config = {
            .SortKeys = true,
        };

        TStringStream output;
        NJson::WriteJson(&output, &json, config);
        YQL_ENSURE(NJson::PrettifyJson(output.Str(), out));
    }

} // namespace NSQLHighlight