Daniela, You Have To Use The Jackson mapper. Search for an example on stackoverflow.
Henry On May 15, 2016 2:14 PM, "Daniela S" <daniela_4...@gmx.at> wrote: > 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" <hotte...@gmail.com> > *An:* user@storm.apache.org > *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" <ncle...@gmail.com> 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" <daniela_4...@gmx.at> wrote: >>> >>> Hi >>> >>> I 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 >>> >>