3

Can somebody please explain to me how in the fuck does :
{
"src" : "./template.html",
"format" : "plain",
"input" : {
"noun" : "World"
},
"replace" : "templateExampleSkeleton"
}

Result in:
format: "plain"
input: "[object Object]"
replace: "templateExampleSkeleton"
src: "./template.html"

When put through JSON.parse()???

Comments
  • 1
    I would say it doesn't at first blush. My guess is it has something to do with the way it's being serialized.
  • 0
    @SortOfTested Thats probably it-- I'm stringifying JSON-ish text into pure JSON and I'm probably doing something wrong -- However the console logging the string before I parse it to an object is exactly the text i put here ¯\_(ツ)_/¯
  • 0
    No idea, dumped it into a file, read it into memory, still works. I would check the producer end of things :)
  • 1
    @SortOfTested Its technically got a bunch of odd white space, might try an use a RegEx to remove the white space, other than that I gotta use ol' reliable...
  • 1
    Heres a fucking development: Taking the text that is logged by console.log(args) and parsing it parses correctly. JSON.parse(args) does not.

    (・_・)
  • 1
    @LostEth0 wut? Is args actually a string and not some other type?
  • 0
    Im pretty sure that all dictionary objects are type Object in JS... maybe the console.log isn't smart enough to iterate through it? Doesn't make sense but then again nothing in JS does...
  • 0
    Iterate through all elements of input.
  • 0
    @epse No, its a string alright, unless TypeScript is having a stroke
  • 0
    Can't confirm here, works just fine.
  • 1
    @PrivateGER ended up being a bug later on in my code. I’m mad that I missed it, it was a .toString()
  • 1
    new Function(„return „ + jsonIsh);
Add Comment