Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Convert javascript to strict JSON server-side

    Hi there,

    Do you have any server-side APIs that can be used to convert one of your viewstate strings into strict JSON? We are storing grid viewstate information in our DB and looking for a way to access the viewstate information server-side but it needs to be converted to strict JSON. Here is a sample we are trying to convert:

    ({field:[{name:"assetNameShort",autoFitWidth:false,width:175},{name:"currentPrice",precision:"4",width:100},{name:"expectedReturn",autoFitWidth:false,precision:"1",width:74},{name:"optionDeltaAdjustedExposure",precision:"1",width:100},{name:"absOptimalPosition",precision:"1",width:100},{name:"assetReturnImprovement",precision:"0",width:100},{name:"pctCurrentFromOptimal",precision:"1",width:100},{name:"assetRewardImprovement",precision:"0",width:100},{name:"assetRiskReduction",precision:"0",width:100},{name:"avgVolumeValue",precision:"1",width:100},{name:"scenariosModified",width:100},{name:"scenariosModifiedPctChange",precision:"1",width:100},{name:"analystInitials",width:65}],sort:{fieldName:null,sortDir:"ascending",sortSpecifiers:[{direction:"ascending",property:"longShortIndicator"},{direction:"descending",property:"assetReturnImprovementPct"}]},group:[{fieldName:"longShortIndicator",groupingMode:null,groupGranularity:null,groupPrecision:null}]})

    #2
    The interior format of viewState is undocumented and subject to change without notice, so there's little point in attempting to parse or modify it. But if you are just experimenting or something, a regexp is probably sufficient, since there are no dates or other tough cases.

    Comment

    Working...
    X