We can convert JSON to Form (https://github.com/playframework/playframework/blob/master/framework/src/play/src/main/scala/play/api/data/Form.scala#L393).
However, we can’t convert Form to JSON.
What I am doing at the moment is:
form.fill(data).data. Then, I serialize
data, which is
Map[String, String], to JSON. This approach, however, serializes an array to, for example,
images, and so on.
It’d be really helpful if we can serialize form to JSON (because it would reuse the unbind methods).
For more context: In a form, I use JSON as its main data. The form submits JSON to Play, and, vice versa, I use the same JSON to populate the form. So, a two-way serialization will be helpful.
If this seems like a good improvement, I’d love to make this improvement to Play.