json - Changing an immutable object F# -


i think title of wrong can't create title reflects, in abstract, want achieve.

i writing function calls service , retrieves data json string. function parses string json type provider. under conditions want amend properties on json object , return string of amended object. if response call

{"property1" : "value1","property2" : "value2", "property3": "value3" } 

i want change property3 new value , return json string.

if jsonprovider mutable exercise like:

type jsonresponse =          jsonprovider<""" {"property1" : "value1",                            "property2" : "value2",                           "property3": "value3" } """>  let jsonresponse = jsonresponse.parse(response) jsonresponse.property3 <- "new value" jsonresponse.tostring() 

however, not work property cannot set. trying ascertain best way resolve this. quite happy initialise new object based on original response amended parameters not sure if there easy way achieve this.

for reference, json object more involved flat example given , contains deep hierarchy.

yes, need create new object, changing bits want , using existing object's values rest. added write apis both xml , json type providers while back. notice types representing json have constructors on them. can see example of in use @ bottom of this link


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -