json - Typescript definitions from postgresql query result -


suppose have complex query returning hierarchical json. how generate typescript definitions of query result?

like martin vseticka wrote, actual json you're getting help. here's semi-complex example had work with:

http://i.stack.imgur.com/wypjt.png

the strategy follow identify lowest level bits of tier , assemble them 1 one under parent until root.

the ts interface describe (with few comments) this:

module rl.ss.portal.rltoday.interfaces {        // don't blame craziness. zoo mms asmx service unleashes when succeeds.      /*          data              termstore                  t: [] of                      ds: string or object, --> description go if there one. blank string if no desciption, otherwise object ->                          td: object ->                              a11: string (the description;  can see , edit description in ui)                      ls: object ->                          tl: object -> **note: array if there multiple labels.                              a31: boolean (seems if it's default value when there multiple labels)                              a32: string (seems value of term string)                      tms: object ->                          tm: object ->                              a12: "locations" (prob term set name)                              a17: boolean (seems indicate whether end users can use tagging. visible in term set ui via site collection admin)                              a24: string (guid, parent id if any)                              a40: string, blank in sample have                              a45: string (guid, not sure what)                              a67: string, blank in sample                      a9: guid of term                      a21: boolean, true if there children                      a61: "0" in sample          hard model since vary on whether array or not based on alternative keywords.          definition assumes there not variable keywords.          none of guids have parenthesis in raw result.      */      export interface mmsasmxtl {          _a31: boolean, // indicates if it's default term label (mainly useful if there multiple labels term)          _a32: string // value of term      }        export interface mmsasmxls {          tl: mmsasmxtl      }        export interface mmsasmxtm {          _a12: string, // name of term set          _a17: boolean, // whether it's available tagging or not          _a24: string, // kind of guid,          _a40: string, // not sure,          _a45: string, // guid, not sure what,          _a67: string // blank string per sample data      }        export interface mmsasmxtms {          tm: mmsasmxtm;      }        export interface mmsasmxtd {          _a11: string; // description of term. not mandatory.      }        export interface mmsasmxds {          td ?: mmsasmxtd // optional, not exist if there's not description      }        export interface mmsasmxt {          ds: mmsasmxds,          ls: mmsasmxls,          tms: mmsasmxtms,          _a9: string, // guid of term          _a21: boolean, // whether there children          _a61: string      }        export interface mmsasmxtermstore {          t: mmsasmxt[]      }        export interface mmsasmxdata {          termstore: mmsasmxtermstore;      }      export interface mmsasmxsuccessresult {          data: mmsasmxdata;      }  }

hth.


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -