Announcement

Collapse
No announcement yet.

Batch processing JSON

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Batch processing JSON

    Using Connector Type: File Reader.

    Have files that looks like:

    Code:
    { id: 1, ... }
    { id: 2, ... }
    { id: 3, ... }
    ...
    Tried going into Data Types and setting Inbound Properties to "Delimited Text" with Record Delimiter as "\n" and that kind of gets me closer to what I want but not there yet.

    How do I send each line as JSON to other connectors?

  • #2
    use batch processing

    In Set Data Types you should use JSON as Inbound and click on Edit in the Inbound Properties/Batch/Javascript. Here you can use the following code:

    Code:
    var line = '';
    while ((line = reader.readLine()) != null) {
    	return line;
    }
    return null;
    At last you have to activate "Process Batch" in the Source Connector Settings (second tab).

    __________
    Greetings

    Comment


    • #3
      This did the trick for me. Thank you!

      Comment


      • #4
        For others that find this thread later, be aware this will only work if your JSON strings are always one line.

        Comment

        Working...
        X