flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fabian Hueske <fhue...@gmail.com>
Subject Re: fileInpuFormat of type json
Date Fri, 18 Nov 2016 08:33:03 GMT
Hi,

there are no built-in methods to read JSON.
How this can be done depends on the formatting of the JSON.
If you have a collection of JSON objects which are separated by newline
(and there are no other newlines) you can read the file with
env.readTextFile().
This will give you one String per line which can be parsed in a subsequent
RichMapFunction. If you do that, you should make sure that the parser is
initialized once (in open()) and not for every call of map().

Best, Fabian

2016-11-17 20:59 GMT+01:00 daviD <dunongo@yahoo.com>:

> Hello,
>
> Does the Flink Scala api have a method for reading json files? If not, are
> there any examples on how this is accomplished?
>
> Thanks
>
> -daviD
>

Mime
View raw message