Skip to content

Commenting last entry fails #9

Open
@sundarv85

Description

When I comment out the last section of a sub object, it fails (where I comment out three). For e.g.

// This is json5 demo
// json5 can write comment in your json
{
  "key" : "Key does not need double quote",
  // json specific
  "of" : "course we can use json as json5",
  "trailing" : "trailing comma is ok",
  "test": {
	"one": {
	  "map": {
	    "name": "world"
	  }
	},
	"two": {
	  "map": {
	    "name": "world"
	  }
	}
	// "three": {
	//   "map": {
	//     "name": "world"
	//   }
	// }	
  }
}

fails with the error

panic: invalid character '/' after object key:value pair

goroutine 1 [running]:
main.check(0x11812c0, 0xc42000a060)
	/test_project/json5/json5.go:12 +0x4a
main.main()
	/test_project/json5/json5.go:24 +0xe6
exit status 2

while, this works (where I comment out two)

// This is json5 demo
// json5 can write comment in your json
{
  "key" : "Key does not need double quote",
  // json specific
  "of" : "course we can use json as json5",
  "trailing" : "trailing comma is ok",
  "test": {
	"one": {
	  "map": {
	    "name": "world"
	  }
	},
	// "two": {
	//   "map": {
	//     "name": "world"
	//   }
	// },
	"three": {
	  "map": {
	    "name": "world"
	  }
	}	
  }
}

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions