| // Copyright 2019 the V8 project authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| #include "src/torque/ls/json.h" |
| #include "src/torque/utils.h" |
| void SerializeToString(std::stringstream& str, const JsonValue& value) { |
| str << StringLiteralQuote(value.ToString()); |
| str << (value.ToBool() ? "true" : "false"); |
| case JsonValue::OBJECT: { |
| for (const auto& pair : value.ToObject()) { |
| str << "\"" << pair.first << "\":"; |
| SerializeToString(str, pair.second); |
| if (++i < value.ToObject().size()) str << ","; |
| for (const auto& element : value.ToArray()) { |
| SerializeToString(str, element); |
| if (++i < value.ToArray().size()) str << ","; |
| std::string SerializeToString(const JsonValue& value) { |
| std::stringstream result; |
| SerializeToString(result, value); |