November 2017
Intermediate to advanced
420 pages
10h 29m
English
The following example reads the JSON representation of the employee object from the emp.json file and uses the javax.json.JsonPointer API to reference the firstName value inside the JSON document and modify its contents.
First, create an instance of JsonObject using JsonReader. Then, define the JsonPointer for the firstName reference. Using JsonPointer, access or modify the value defined against firstName:
public class JSR374JsonPointerExample { private static final Logger logger = Logger.getLogger(JSR374JsonPointerExample.class.getName()); public static void main(String[] args) throws IOException { logger.setLevel(Level.INFO); //Step-1 Read the Target JSON Document using JSR 353 API as mentioned in the ...Read now
Unlock full access