c# - Is there a way to create javascript prototype from json? -


i have webapi expose successfull json formed response.

i have found more , more code use services javascript , return generic json object.

i convert json object javascript prototyped object , before of that, create (one time) prototype code directly json response.

so, there way achive target?

(i have server side .net objects , access code, wouln't use time write dto objects manually).

the single json isn't relevant, example:

{"menu": {   "id": "file",   "value": "file",   "popup": {     "menuitem": [       {"value": "new", "onclick": "createnewdoc()"},       {"value": "open", "onclick": "opendoc()"},       {"value": "close", "onclick": "closedoc()"}     ]   } }} 

i generate it's prototype, as

function menu() {     this.id= '';     this.value= '';     this.popup= '';      this.menuitem = function ()     {         value = null;         onclick = null;     } } 


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -