0

I have this JS object:

{ validator: myValidator }

myValidator is a java JAVASCRIPT function NAME that will be declared somewhere else. I am planning to use it like:

<TableHeaderColumn dataField='status' editable={ { validator: myValidator } }>Job Status</TableHeaderColumn>

where TableHeaderColumn is a react component. So, the question is: What is the JSON string that after using JSON.parse or a similar command I will obtain the { validator: myValidator } object where myValidator is "the name of a function", not a string. This is not clear for me inclusive at the referenced solution.

Vadim Kotov
  • 7,766
  • 8
  • 46
  • 61
Jose Cabrera Zuniga
  • 2,112
  • 2
  • 23
  • 47

1 Answers1

0

To convert a JS Object to JSON, you can use json = JSON.stringify(jsObject)

To convert JSON to a JS Object, just use jsObject = JSON.parse(json)

MLavrentyev
  • 1,704
  • 1
  • 24
  • 31
  • but... how could I represent { validator: myValidator } in JSON so, after parsing from JSON to JS I will get { validator: myValidator }?. In this case myValidator is not a string, but the name of a function. – Jose Cabrera Zuniga Apr 21 '17 at 17:47