nasa8x / rss-to-json

RSS and Atom feed generator for Node.js
https://morioh.com/@5df445b0103f3007600e1a57
177 stars 77 forks source link

Value is not JSON #19

Open tracker1 opened 4 years ago

tracker1 commented 4 years ago

Niggle: this output is NOT JSON. JSON is a string, it's always a string that represents a primitive value, array or object structure in JavaScript notation.

What you have is an RSS parser for JS.

moghwan commented 4 years ago

Just convert it to json format with JSON.parse(), ex:

Feed.load('https://morioh.com/feed', function(err, rss){
    result = JSON.parse(JSON.stringify(rss, null, 3));

    console.log(result);
    console.log(typeof(result));
});
LingVuDev commented 3 years ago

@tracker1 Just for reference. JSON itself is a notation format. If you refer to the content of a .json file then you are right, but generally this library does exactly what it states.

https://www.json.org/json-en.html

tracker1 commented 3 years ago

@LingVuDev it doesn't return the notation/string... it returns an Object. JSON is a serialization structure.