[Haskell-cafe] Lenses: Changing/creating values deep inside JSON or HashMap

Jan von Löwenstein jan.loewenstein at gmail.com
Tue Dec 20 09:38:30 UTC 2016


Hi,

I want to have code that produces the following result no matter if input A
or B was given:

Result:
{
  "outer" : {
                  "inner" : "new-value"
                }
}

A:
{
  "outer" : {
                  "inner" : "old-value"
                }
}

B:
{}

`json & key "outer"._Object.key "inner" .~ "new-value"` didn't work.

Is what I want even possible with lenses?

Best
Jan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20161220/c2f7d492/attachment.html>


More information about the Haskell-Cafe mailing list