Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Aug 10, 2023. It is now read-only.
This repository was archived by the owner on Aug 10, 2023. It is now read-only.

Add ultility to construct JsonStructure from raw JSON string #69

Copy link
Copy link

Description

@glassfishrobot
Issue body actions

Currently, JsonArrayBuilder and JsonObjectBuilder can be used to create JSON object models from scratch. However, the process is cumbersome and verbose. There should be an easier way for doing this.

I am proposing something like the following:

JsonArray a = JsonUtil.getArray(
    "[{'abc': 'xyz', 'ss': 1234}, {'m\\'n': 'l\"m'}]");

Note that I'm using single quotes for JSON strings, otherwise I'll have lots of " as required in Java. I am not proposing allowing single quotes for JSON string (which is not allowed in JSON) in general. This utility will need to convert ' to " before sending it to JsonReader.

Note also \ is used to allow ' or " inside the JSON string, but this is just some details that we should not worry for now.

Such utility will be very useful in writing JSON tests. But it should be useful to JSON users.

Reactions are currently unavailable

Metadata

Metadata

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

Morty Proxy This is a proxified and sanitized view of the page, visit original site.