Tutorial by Examples

import play.libs.Json; public JsonNode createJson() { // {"id": 33, "values": [3, 4, 5]} ObjectNode rootNode = Json.newObject(); ArrayNode listNode = Json.newArray(); long values[] = {3, 4, 5}; for (long val: values) { listNode.add(val); ...
import play.libs.Json; // (...) Loading a file from your public folder // Note: "app" is an play.Application instance JsonNode node = Json.parse(app.resourceAsStream("public/myjson.json")); Load from a string String myStr = "{\"name\": \"John Doe\&qu...
In the following examples, json contains a JSON object with the following data: [ { "name": "John Doe", "work": { "company": { "name": "ASDF INC", "country": "USA" }, ...
By default, Jackson (the library Play JSON uses) will try to map every public field to a json field with the same name. If the object has getters/setters, it will infer the name from them. So, if you have a Book class with a private field to store the ISBN and have get/set methods named getISBN/setI...

Page 1 of 1