Steemd / NodeJS / Unable to JSON.parse a specific comment

in #nodejs8 years ago

I ran into a problem while working on rebuilding the index for SteemShovel.com and upgrading the search options.  I was using piston.rocks to index the blocks but it was too slow so I'm talking directly to steemd over the Websocket api.  I am blasting through blocks like crazy now until I hit block  3061327.  For some reason the comment id  2.8.51129 breaks the JSON.parse() method when I try to parse it.  What's really odd is that if I copy and paste the stringified JSON directly into a test.js file and assign it to a variable, it works fine. I can also use an online JSON parser and it works fine.  I am really at a loss here as to what the problem is.  

I'm doing a simple "get_content" call to steemd and getting back:

 {"id":2,"result":{"id":"2.8.51129","author":"aaronfisher","permlink":"i-just-thought-i-would-start-with-a-joke-and-start-to-introduce-myself","category":"jokes","parent_author":"","parent_permlink":"jokes","title":"I just thought I would start with a joke and start to introduce myself.","body":"https://i.imgsafe.org/1a1f131d26.jpg\n\nLittle April was not the best student in Sunday school. Usually she slept through the class. One day the teacher called on her while she was napping, \"Tell me, April, who created the universe?\" When April didn't stir, little Johnny, a boy seated in the chair behind her, took a pin and jabbed her in the rear. \"GOD ALMIGHTY!\" shouted April and the teacher said, \"Very good\" and April fell back asleep. \n\nA while later the teacher asked April, \"Who is our Lord and Saviour,\" But, April didn't even stir from her slumber. Once again, Johnny came to the rescue and stuck her again. \"JESUS CHRIST!\" shouted April and the teacher said, \"very good,\" and April fell back to sleep. \n\nThen the teacher asked April a third question. \"What did Eve say to Adam after she had her twenty-third child?\" And again, Johnny jabbed her with the pin. This time April jumped up and shouted, \"IF YOU STICK THAT F*****G THING IN ME ONE MORE TIME, I'LL BREAK IT IN HALF AND STICK IT UP YOUR ARSE!\" \n\n\nThe Teacher fainted.\n\nMade me smile and was among many funny jokes on my pc, not sure who wrote it. Anyhoo, the plan is to post stuff that interests me and link to the clever people who create, however I am not the most talented writer. I have some other ideas for fundraising opportunities I would like to try out... Life is full of amazing ups and downs and this digital currency revolution is super exciting to participate in. \n\nMy digital currency hobby is the creation of pinkcoin.ca. I hope to expand my site into a hub of digital currency donations, which we can transparently distribute to those in a bit of a tough spot in life. I am obsessed with helping people and cant get enough of that feeling. Microtipping is a great way to help and not break the bank. If your family is anything like mine you work your butts off and often there is not much left for a donation. Digital currency and blockchain transparency will enhance or allow me to get excited about giving money to people. We can follow the money donated to its intended recipient, or simply send it in a tweet!\n\nI often wondered how to express and document the contributions pinkcoin.ca will make. Imagine the potential of this Steemit platform in addition to pink for fundraising!  I am excited to see what we can acheive! \n\nSo... my first post.\n\nWhy does this feel like my first sexual encounter? I'm sorry, lol, I'll last longer next time and with practice may even get good at it! \n\n😂\n\nhttps://i.imgsafe.org/1a17a691d6.pn","json_metadata":"{\"tags\":[\"introduceyourself\",\"pinkcoin\",\"jokes\"],\"image\":[\"https://i.imgsafe.org/1a1f131d26.jpg\"]}","last_update":"2016-07-10T01:17:48","created":"2016-07-09T23:54:57","active":"2016-07-10T01:17:48","last_payout":"2016-07-10T23:54:57","depth":0,"children":0,"children_rshares2":"0","net_rshares":0,"abs_rshares":0,"vote_rshares":0,"children_abs_rshares":0,"cashout_time":"1969-12-31T23:59:59","max_cashout_time":"1969-12-31T23:59:59","total_vote_weight":0,"total_payout_value":"0.000 SBD","curator_payout_value":"0.000 SBD","author_rewards":0,"net_votes":1,"root_comment":"2.8.51129","max_accepted_payout":"1000000.000 SBD","percent_steem_dollars":10000,"allow_replies":true,"allow_votes":true,"allow_curation_rewards":true,"url":"/jokes/@aaronfisher/i-just-thought-i-would-start-with-a-joke-and-start-to-introduce-myself","root_title":"I just thought I would start with a joke and start to introduce myself.","pending_payout_value":"0.000 SBD","total_pending_payout_value":"0.000 SBD","active_votes":[{"voter":"aaronfisher","weight":0,"rshares":248988083,"percent":10000,"time":"2016-07-09T23:54:57"}],"replies":[]}} 

If anyone has any idea what the problem is please let me know.  I don't want to just skip the block but I also don't want to manually parse the string to get the details either.

Coin Marketplace

STEEM 0.21
TRX 0.21
JST 0.035
BTC 92187.28
ETH 3145.26
USDT 1.00
SBD 3.04