[Solved] JScript AddColumn does not work, what am I doing wrong?

@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 :slight_smile:

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 :slight_smile: 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 :slight_smile:

1 Like

That looks like it might be a UTF-8 BOM.

You are probably right. After you said this, I think I remember now making this json file in Notepad and saving it specifically as UTF-8.

I had to google what the hell is that BOM :smile: Never actually had a problem like this before.

Please cut out the swearing, especially in huge bold headings. People read the forum at work and it can cause problems for them.

Sorry, it was just a very accurate description of how I felt after a week of hair-pulling :slight_smile: