playframework Java - Working with JSON Loading json from string/file


Example

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\"}";
JsonNode node = Json.parse(myStr);