Topic: Reading JSON in java
Hello,
I have two questions about the Wialon Java API.
How can I validate the null data in the following parameter?
System.out.println("params: " + ((Unit)item).getMessageParams());
Output when the value is null I get the following answer:
Output: params:null
The second question is: when do you get the parameter values as the next answer, how can I read only the value with "v"?
Output: params: {adc1={v=0.0, ct=1.508226655E9, at=1.508372739E9}, cell_id={v=1.38685781E8, ct=1.508370039E9, at=1.508372739E9}, engine={v=0.0, ct=1.508366316E9, at=1.508372739E9}......
For example, if the code have the next sentence:
System.out.println("engine: " + ((Unit)item).getMessageParams().get("odometer"));
The Output is: {v=0.0, ct=1.508366316E9, at=1.508372739E9}
But, I need the value "v=0.0", Can you help me, please?
I wait comments or ideas.
Thank you very much.