Skip to content

how to parse selected values from json? #23

@domi771

Description

@domi771

I have the following code:

request({url: 'https://myurl.com/stream?method=json'})
    .pipe(JSONStream.parse('*'))     
    .pipe(es.mapSync(function (data) {
      console.log(data);
      var var1 = JSON.stringify(data);
      io.emit('notification', var1);
    }))

which works perfect for receiving ALL data from the json stream or when I change

    .pipe(JSONStream.parse('*')) 

to

.pipe(JSONStream.parse('Name')) 

to get only the name.

However what do I need to do in order to get

Name, Address and ZIP from the json stream? I could nowhere find the answer to this.

The JSON looks like this:

{"Date":"2015-03-16T13:00:12.860630336Z","Name":"Peter","Address":"Demostreet","ZIP":"1234"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions