Skip to content

Replace json-simple with Jackson - #139

Merged
bgrozev merged 7 commits into
masterfrom
remove-json-simple
Jun 10, 2026
Merged

Replace json-simple with Jackson#139
bgrozev merged 7 commits into
masterfrom
remove-json-simple

Conversation

@bgrozev

@bgrozev bgrozev commented Jun 1, 2026

Copy link
Copy Markdown
Member

Replace the org.json.simple dependency with Jackson (jackson-databind).

  • Migrate JSONSerializer, JSONDeserializer (colibri), Colibri2JSONSerializer, Colibri2JSONDeserializer to use ObjectNode/ArrayNode
  • Public API now uses ObjectNode/ArrayNode instead of JSONObject/JSONArray
  • Update jitsi-utils to 1.0-SNAPSHOT

Replace org.json.simple dependency with Jackson (jackson-databind).
Update jitsi-utils to 1.0-SNAPSHOT.
JSONSerializer/JSONDeserializer now use ObjectNode/ArrayNode.

if (s.startsWith("-"))
{
i = Integer.parseInt(s);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand what this code here is doing. Is it trying to handle the case where ssrc's accidentally got serialized as signed 32-bit values, or is it handling the -1 meaning missing ssrc? Either way I think your changes change the behavior, though I'm not sure if it makes it better or worse. Will we ever expect SSRCs to be JSON strings rather than JSON numbers?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what the original intent was, handling -1 seems like a reasonable guess. I reverted the functional change.

bgrozev added 2 commits June 3, 2026 03:54
Replace jsonMapper.createObjectNode()/createArrayNode() with
JsonNodeFactory.instance.objectNode()/arrayNode() everywhere.
Remove now-unused jacksonObjectMapper instance and import.
Revert unintentional functional change from json-simple migration:
deserializeSSRC was changed from returning int to long. Restore int
return type and use asInt() to match original behavior exactly.
{
deserializeWebsocket(
(String)webSocket,
webSocket.isTextual() ? webSocket.asText() : null,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the error path on a non-textual item from a bad cast exception to a silent null in the data - do we care?

for (Map.Entry<Object, Object> e
: (Iterable<Map.Entry<Object, Object>>) parameters
.entrySet())
parameters.fields().forEachRemaining(e ->

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are forEach and forEachRemaining different here? Why did you use the latter?

ObjectNode rtcpFb = (ObjectNode) iter;
JsonNode typeNode = rtcpFb.get(RtcpFbPacketExtension.TYPE_ATTR_NAME);
JsonNode subtypeNode = rtcpFb.get(RtcpFbPacketExtension.SUBTYPE_ATTR_NAME);
String type = (typeNode != null && typeNode.isTextual()) ? typeNode.asText() : null;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly here - I worry that this will introduce silent nulls into code that's not expecting it, and thus trigger exceptions in different places in the code than would previously have had them.

bgrozev added 3 commits June 8, 2026 04:49
Replace silent ignore patterns with IllegalArgumentException where
a field is present but has an unexpected JSON type. Previously the
code would silently skip or return null; now it fails explicitly
with a descriptive message.
Replace all silent-ignore type checks with require() calls that throw
IllegalArgumentException on unexpected field types. Also fixes
headers.fields() deprecated call to use properties().
JonathanLennox
JonathanLennox previously approved these changes Jun 9, 2026
@bgrozev
bgrozev merged commit fe4b514 into master Jun 10, 2026
4 checks passed
@bgrozev
bgrozev deleted the remove-json-simple branch June 10, 2026 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants