Hi,
thank you very much for your answers. But unfortunately I do not have a JSON object yet, I only have a String, containing a JSON object. I receive the Strings from Kafka but I do not know how to get the information out of the String.
example: {"timestamp": 1463335828342, "ID":570,"command":"START"}
I would like to extract the three fields out of the String. Then I would like to store it into Redis.
Afterwards I would like to pull all the stored (active) devices out of Redis and to build a sum over all the devices every minute. For building the sum I have to add another value for every device. I would like to use Redis as a kind of cache.
Regards,
Daniela
Gesendet: Sonntag, 15. Mai 2016 um 20:06 Uhr
Von: "Henry Hottelet" <[email protected]>
An: [email protected]
Betreff: Re: Split Kafka JSON String
Von: "Henry Hottelet" <[email protected]>
An: [email protected]
Betreff: Re: Split Kafka JSON String
Try using intellij plug in that converts json to pojo classes
On May 15, 2016 2:04 PM, "Nathan Leung" <[email protected]> wrote:
Easiest way is to map your job to a pojo and use Jackson or gson to convert the json.
On May 15, 2016 1:48 PM, "Daniela S" <[email protected]> wrote:HiI am receiving Strings of JSON from Kafka. I would like to split the string to get each field from the JSON object to store it into Redis.How can I split the string and assign the parts to variables?Thank you in advance.Regards,Daniela
