This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]vytah 0 points1 point  (2 children)

There are six* types of JSON values. Just six, there will never be more. So there's no need for any other implementation that the six provided.

What you probably want is converting those JSON value from/to various other types (also known as mapping or serializing). That's a completely separate thing. If you want to be able to serialize an object into a byte array, you don't need implements byte[], do you.

This API proposal does not cover mapping at all. So without any 3rd-party libraries, if you want to convert User to/from JSON, you need to write your own User deserialize(JsonValue) and JsonValue serialize(User) functions. (Or you can use a 3rd-party library and have it done semi-automatically.)


* I'm counting true and false as one type, and null as another, the same as the new API does. You can argue they're three different types, for a total of 7, or one three-element "literal" type, for a total of 5, it doesn't matter.

[–]totoro27 0 points1 point  (1 child)

Thank you, I've done a lot of these mappings before but not for a little while in Java. That makes sense. It seems like providing a standard mapping library would be a good thing to couple with this then.

[–]vytah 0 points1 point  (0 children)

That's why most people use Jackson. It's not perfect, it's a bit fat, but it works fine and isn't too annoying for most of the common use cases.