| 45 | } |
| 46 | |
| 47 | Ref<ByteBuffer> serializeValue(const Value& value) { |
| 48 | auto out = makeShared<ByteBuffer>(); |
| 49 | |
| 50 | const auto* map = value.getMap(); |
| 51 | if (map != nullptr) { |
| 52 | auto keys = value.sortedMapKeys(); |
| 53 | |
| 54 | for (const auto& key : keys) { |
| 55 | auto value = map->find(key)->second.toStringBox(); |
| 56 | |
| 57 | auto keyStrView = key.toStringView(); |
| 58 | auto valueStrView = value.toStringView(); |
| 59 | |
| 60 | out->append(keyStrView.begin(), keyStrView.end()); |
| 61 | out->append('='); |
| 62 | out->append(valueStrView.begin(), valueStrView.end()); |
| 63 | out->append('\n'); |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | return out; |
| 68 | } |
| 69 | |
| 70 | static void writeTypedObjectToJSONWriter(const ValueTypedObject& typedObject, JSONWriter& writer) { |
| 71 | writer.writeBeginObject(); |