-
Notifications
You must be signed in to change notification settings - Fork 658
Add JsonObject field reading syntax sugar #3019
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: dev
Are you sure you want to change the base?
Conversation
public fun JsonObject.getJsonArray(key: String): JsonArray? = this[key]?.jsonArray | ||
public fun JsonObject.getJsonPrimitive(key: String): JsonPrimitive? = this[key]?.jsonPrimitive | ||
public fun JsonObject.getJsonNull(key: String): JsonNull? = this[key]?.jsonNull | ||
public fun JsonObject.getIntOrNull(key: String): Int? = this[key]?.jsonPrimitive?.intOrNull |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This (and similar) functions should include a check that it is not a string isString
should return false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pdvrieze Can you review it |
@huicunjun It looks good to me (not an official maintainer so can't do anything beyond that) |
Add Enhanced JsonObject deserialization and field reading syntax sugar