- Issue created by @omarlopesino
- 🇦🇺Australia almunnings Melbourne, 🇦🇺
Hiya
Custom Scala should just return the content as is
Which would return the json from the field?Or does it not do that?
Or are you needing it as a php array earlier for any specific reason? - 🇪🇸Spain omarlopesino
I confirm that Scala returns the context as it is , but the problem is that the returned json by the formatter is a plain text of the json, and not the json decoded.
Then, in the GraphQL view, instead of returning
"myJsonField": { "foo": "bar" }
it returns:
"myJsonField": "\<code>{\r\n \"foo\": \"bar\"\r\n}\</co..>"
This MR allows recognizing this specific case and do the conversion.
- 🇦🇺Australia almunnings Melbourne, 🇦🇺
Gotcha! Ok I’ll review this at lunchtime today.
- 🇦🇺Australia almunnings Melbourne, 🇦🇺
I've mutilated your nice 3 liner (sorry!), but the class needed a good cleanup :D
With this change, set toraw + scalar
, and it'll attempt to convert from json.Let me know if this suits
- 🇪🇸Spain omarlopesino
I've checked this and it works fine. I prefer this solution rather than the previous one as it not rely anymore in the values returned by formatters, so results are more predictible. Thanks!
Moving to RTBC
-
almunnings →
committed 1bafced6 on 2.4.x authored by
omarlopesino →
Issue #3509190: Support Json field output
-
almunnings →
committed 1bafced6 on 2.4.x authored by
omarlopesino →