Last active
June 27, 2016 22:32
-
-
Save DeepSpawn/46d0f07123a227d9daa7392a2b471b2a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String show(final Json json) { | |
return json.match( | |
seq -> seq.getElems().stream() | |
.map(j -> show(j)) | |
.collect(Collectors.joining(",", "[", "]")), | |
jobject -> jobject.getMembers().entrySet().stream() | |
.map(kv -> "\"" + kv.getKey() + "\":" + show(kv.getValue())) | |
.collect(Collectors.joining(",", "{", "}")), | |
jnumber -> jnumber.getNum().toString(), | |
jstring -> "\"" + jstring.getStr() + "\"", | |
jboolean -> jboolean.getB().toString(), | |
jNull -> "null" | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment