@wowbagger thank you so much for all your help. I actually have managed to work it out what was going on and why it wasn't working for me. Brace yourself
So, after about a whole week trying to work this shit out:
- I switched from vbscript to jscript (actually I didn't know either of them, so both were a learning curve... although jscript syntax is way more understandable and easier to use, I must say)
- I rewrote the script maybe 10 different ways to try things out
- I even reinstalled windows (switched from 8.1 to 10)
- nothing helped, because it seems
JSON.parse
was refusing to work on my system for whatever reason
Then I accidentally found out why. And the reason was... drum roll... invisible/hidden garbage chars in my json file:
รฏยปยฟ{
"Status": "done",
"Category": "move"
}
At least I assume that this was the culprit.
I have no idea how that garbage got there, because I can't remember exactly what editor I used to create the file. The list of editors I could have used:
- notepad
- VS Code
- Sublime Text
- Visual Studio
- WebStorm
Or maybe even some other editor/IDE, but probably it was one 5 above. My money is on that f****er Notepad.
Was this because of text encoding, or something like that? I am kinda interested how or why this would happen.
Well, live and learn. You guys asked me what is in that f***ing file. Well, I looked at it in a text editor - and those chars never showed. Until I simply read the file and wrote to output As simple as that.
JSON.parse
works as it should and my script finally is complete.
Sorry, that I could not write this down yesterday, when I found this. But like I said before - I am in the middle of migrating my server, so I was busy with that.
Thanks so much, anyone, who tried to help. This community is awesome.
@wowbagger you rock, dude, thanks again.
I will most certainly look into your XML and XPath columns script, that sounds like exactly what I was going after next