-
Notifications
You must be signed in to change notification settings - Fork 165
not able to parse large JSON object with JSON.parse() #109
Comments
The issue is, that you parse the |
Thanks Poetro for the reply. Could you please elaborate a little bit more as I am completely new to JavaScript NodeJs etc.. like how can i use "JSONStream" . If you could give me a reference material which I can refer, that would be great. |
It would be something like without using http.request(options, function(res) {
var buffers = []
res
.on('data', function(chunk) {
buffers.push(chunk)
})
.on('end', function() {
JSON.parse(Buffer.concat(buffers).toString())
})
}) For using it with JSONStream, it would be something like: http.request(options, function(res) {
var stream = JSONStream.parse('*')
res.pipe(stream)
stream.on('data', console.log.bind(console, 'an item'))
}) |
Thanks a lot mate. Its working like a charm now. You made my day. Thanks again. Also could you refer me a good book to learn node to get upto speed. |
There are some good / acceptable books from Packt, like Node.js Design Patterns and Mastering Node.js which I read, but there must be some more up to date ones. |
@Poetro thanks for doing a great job of support on my module, I really appreciate it! |
Hi,
I have a RestFul Service which returns JSON string.
I am using an Electron application which uses NODEJS scripts under the hood. In that code i am calling my a .Net Rest Service and trying to parse the JSON data with JSON.parse(). When JSON strings length is less than ~8500 , It works fine , But when it goes beyond this then I get the below error.
VM156:1 Uncaught SyntaxError: Unexpected token : in JSON at position 6
Like in this example the JSON length was 65000 . Please help to get rid of the error.
My aim is to fetch 100 rows from a table in oracle and display on the form using ELECTRON application.
Thanks & Regards
Shobhit
The text was updated successfully, but these errors were encountered: