oboe.js icon indicating copy to clipboard operation
oboe.js copied to clipboard

unable to parse keys that are empty strings

Open tmkujala opened this issue 9 years ago • 3 comments

Hi,

When parsing JSON that looks like this:

{
  "key1": "value1",
  "": "value2"
}

An error is thrown and the parsing is unsuccessful:

TypeError: Cannot read property '0' of undefined
    at C:\test\node_modules\oboe\dist\oboe-node.js:121:33
    at appendBuiltContent (C:\test\node_modules\oboe\dist\oboe-node.js:1453:15)
    at nodeOpened (C:\test\node_modules\oboe\dist\oboe-node.js:1434:7)
    at C:\test\node_modules\oboe\dist\oboe-node.js:1048:19
    at applyEach (C:\test\node_modules\oboe\dist\oboe-node.js:496:20)
    at emit (C:\test\node_modules\oboe\dist\oboe-node.js:1929:10)
    at handleData (C:\test\node_modules\oboe\dist\oboe-node.js:860:18)
    at applyEach (C:\test\node_modules\oboe\dist\oboe-node.js:496:20)
    at Object.emit (C:\test\node_modules\oboe\dist\oboe-node.js:1929:10)
    at ReadStream.<anonymous> (C:\test\node_modules\oboe\dist\oboe-node.js:1128:34)

The issue is with empty strings that are property keys. This error was originally posted in #86, but it doesn't appear to be related to that issue. I've spent a few hours trying to debug the issue, but have come up empty handed.

tmkujala avatar May 31 '16 18:05 tmkujala

+1 I have the same issue

richardspence avatar Jun 06 '16 23:06 richardspence

I've found and fixed the issue, which is in the forked clarinet module. I ended up fixing it in the current clarinet project as well (dscape/clarinet#43) just to get some more unit tests running against my logic. I'll be filing a pull request against oboe.js shortly.

tmkujala avatar Jul 05 '16 19:07 tmkujala

I verified the problem here https://square-gem.hyperdev.space/

JuanCaicedo avatar Aug 17 '16 03:08 JuanCaicedo