Custom Source Function for reading JSON?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Custom Source Function for reading JSON?

juanramallo80
Hi Flink Community!

I am new using Apache Flink and I have a problem reading a JSON.

I am using a JSON from a webpage, this JSON is changing continuosly so I decided to use my own Source Function in order to grab the JSON using a URL that is always the same: http://www.example/blabla/this.json

I have been looking the other Source Functions from Github, but I am not able to read it. I want to take the JSON, parse it and transform it into a java class with some of the attributes and values that I need.

When I compare other examples, they use SourceContext with String, but I dont really want to send an String. I got stuck in that part and I am looking for the best way of doing this.

Thanks for your attention!

Iñaki

Reply | Threaded
Open this post in threaded view
|

Re: Custom Source Function for reading JSON?

Gábor Horváth
Hi!

On 14 May 2016 at 23:47, iñaki williams <[hidden email]> wrote:
Hi Flink Community!

I am new using Apache Flink and I have a problem reading a JSON.

I am using a JSON from a webpage, this JSON is changing continuosly so I decided to use my own Source Function in order to grab the JSON using a URL that is always the same: http://www.example/blabla/this.json

I have been looking the other Source Functions from Github, but I am not able to read it. I want to take the JSON, parse it and transform it into a java class with some of the attributes and values that I need.

Sorry, but this part is not clear to me. Do you plan to create new classes at runtime and instantiate objects, or you do have the class at compile time and you want to create objects using the values extraced from the JSON text?
 

When I compare other examples, they use SourceContext with String, but I dont really want to send an String. I got stuck in that part and I am looking for the best way of doing this.

Thanks for your attention!

Iñaki


Regards,
Gábor

Reply | Threaded
Open this post in threaded view
|

Re: Custom Source Function for reading JSON?

juanramallo80
Hi!

I have the class, I want to create objects using the values extraced from the JSON text, my fault haha.

Sorry for that

2016-05-15 19:10 GMT+02:00 Gábor Horváth <[hidden email]>:
Hi!

On 14 May 2016 at 23:47, iñaki williams <[hidden email]> wrote:
Hi Flink Community!

I am new using Apache Flink and I have a problem reading a JSON.

I am using a JSON from a webpage, this JSON is changing continuosly so I decided to use my own Source Function in order to grab the JSON using a URL that is always the same: http://www.example/blabla/this.json

I have been looking the other Source Functions from Github, but I am not able to read it. I want to take the JSON, parse it and transform it into a java class with some of the attributes and values that I need.

Sorry, but this part is not clear to me. Do you plan to create new classes at runtime and instantiate objects, or you do have the class at compile time and you want to create objects using the values extraced from the JSON text?
 

When I compare other examples, they use SourceContext with String, but I dont really want to send an String. I got stuck in that part and I am looking for the best way of doing this.

Thanks for your attention!

Iñaki


Regards,
Gábor