1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

JSON: Add new JSON::Formatter for configuring JSON output

This also fixes an issue where MIDI CI header data could contain spaces,
which is not allowed according to the spec.
This commit is contained in:
reuk 2023-12-05 14:35:09 +00:00
parent 06855ed05d
commit 224c4f706b
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
12 changed files with 203 additions and 96 deletions

View file

@ -53,7 +53,7 @@ struct Encodings
/** Converts a JSON object to a list of bytes in 7-bit ASCII format. */
static std::vector<std::byte> jsonTo7BitText (const var& v)
{
return stringTo7BitText (JSON::toString (v, true));
return stringTo7BitText (JSON::toString (v, JSON::FormatOptions{}.withSpacing (JSON::Spacing::none)));
}
/** Each group of seven stored bytes is transmitted as eight bytes.

View file

@ -165,7 +165,7 @@ private:
const auto json = ToVar::convert (body, opts);
if (json.has_value())
*result = String (getDescription (body)) + ": " + JSON::toString (*json, true);
*result = String (getDescription (body)) + ": " + JSON::toString (*json, JSON::FormatOptions{}.withSpacing (JSON::Spacing::none));
}
const Message::Parsed* msg = nullptr;