Hi Ben,

I use JSON quite extensively when pushing updates out from a Tapestry service, via websocket, to remote desktop client apps. So I'm keen for any Tapestry enhancements that might streamline JSON support.

Mostly I use com.fasterxml.jackson for this.

Kind regards,

Chris Dodunski.


On 2020-07-25 19:33, Ben Weidig wrote:
Hi,

I'm thinking about improving tapestry-json but wanted to ask first if
there's actually some interest in doing so, before starting to code and
making a pull-request.

We have multiple utility classes for simpler JSON usage:

JSONArray:
- static JSONArray safeNew(String jsonStr)
- JSONArray from(Iterable<?> iterable)
- JSONArray from(Iterable<?> iterable, boolean preserveNull)
- boolean putUnique(Object obj)
- multiple typed toList(...) which might be refactored into a single
generic method

JSONObject:
- static JSONObject safeNew(String jsonStr)
- <K, V> Map<K, V> toMap(Function<String, K> keyFn, Function<Object, V>
valueFn)
- static JSONObject from(Map<String, Object> map)

JSONCollectors:
- static <T> Collector<T, JSONArray, JSONArray> toArray()
- a collector to JSONObject wasn't needed so far

Other functionality I would like to add:
- Stream-Support for JSONArray
- Safe getters, e.g., Optional<String> JSONArray#tryGet(String key),
although I haven't thought much about correct null vs NULL-sentinel
handling.

What do you think? Worth the effort, or really on utility classes?

Ben

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org
For additional commands, e-mail: dev-h...@tapestry.apache.org

Reply via email to