Looping through JSON with node.js

前端 未结 9 1654
感情败类
感情败类 2020-12-08 00:04

I have a JSON file which I need to iterate over, as shown below...

{
    \"device_id\": \"8020\",
    \"data\": [{
        \"Timestamp\": \"04-29-11 05:22:39         


        
9条回答
  •  悲哀的现实
    2020-12-08 00:56

    If you want to avoid blocking, which is only necessary for very large loops, then wrap the contents of your loop in a function called like this: process.nextTick(function(){}), which will defer execution until the next tick, giving an opportunity for pending calls from other asynchronous functions to be processed.

提交回复
热议问题