This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 152545

Summary: token FUNCTION in JSON code not recognized
Product: javascript Reporter: koppor <koppor>
Component: JSONAssignee: Petr Pisl <ppisl>
Status: NEW ---    
Severity: blocker    
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:
Bug Depends on:    
Bug Blocks: 152546    

Description koppor 2008-11-06 14:55:27 UTC
I'm trying to edit following (valid) JSON-File:
http://code.google.com/p/oryx-editor/source/browse/trunk/editor/data/stencilsets/bpel/bpel.json

It includes following code:

"layout":function(shape) {		
  var raiseEvent = shape._delegateEvent.bind(shape);
  raiseEvent({type:'layout.rows',shape:shape,marginTop:30,marginLeft:30,spacingX:30,spacingY:30});	
},

An error "Invalid JSON: unexpected token FUNCTION" is shown.

However, the json works perfectly in Firefox.

Is it possible to add support for the function token?

The code also makes use of "undefined" (which is undefined :)).
At this element, the error "Invalid JSON: unexpected token NAME" is shown. I think, this behavior valid.
Comment 1 musicalshore 2011-12-13 19:17:53 UTC
I'm getting the same problem with very simple JSON files. Below is my JSON:

{
    success: true,
    users: [
        {id: 1, name: 'Ed',    email: 'ed@sencha.com'},
        {id: 2, name: 'Tommy', email: 'tommy@sencha.com'}
    ]
}



I get 'unexpected token NAME' complaints.