Hi to all,
I've started to do a little project using JSON string.
Simply i call api from web service, passing an IP Address, and it returns me a json response containing informations about the sended IP.
So i want to know what is the best approch to manipulate information from json response (I know the existence of JSONParser and i know how to use it).
For now i thinked three way to do this:
My purpose in this case, in addition to writing an application that given an ip address returns the related information, is to write a library for B4J.
So I thought of method 1.
I hope I was clear in explaining my doubt.
I've started to do a little project using JSON string.
Simply i call api from web service, passing an IP Address, and it returns me a json response containing informations about the sended IP.
So i want to know what is the best approch to manipulate information from json response (I know the existence of JSONParser and i know how to use it).
For now i thinked three way to do this:
- Create a class (or CostumClass) for each object inside the JSON response and using a master Class for assign each object inside JSON Text to the correct class (Maybe with select case innested in for loop where i slide keys of map and recursivly calls this 'sub' for each object inside an another object);
- Create one class that get the entire json string, get parsing it and using specific methods to get data i want from this "general class" that implement all informations;
- Create one class not related completely to parsing json but that can have other methods relative to class that rappressent, so data are taken and used from Map.GetKey() if necessary.
My purpose in this case, in addition to writing an application that given an ip address returns the related information, is to write a library for B4J.
So I thought of method 1.
I hope I was clear in explaining my doubt.