[Info-vax] Simple Pascal question
Simon Clubley
clubley at remove_me.eisner.decus.org-Earth.UFP
Thu Sep 5 13:30:49 EDT 2024
On 2024-08-08, Arne Vajhøj <arne at vajhoej.dk> wrote:
> On 8/8/2024 8:13 AM, Simon Clubley wrote:
>> On 2024-08-07, Arne Vajhøj <arne at vajhoej.dk> wrote:
>>> On 8/7/2024 5:35 PM, Lawrence D'Oliveiro wrote:
>>>> Dates/times? You have to contend with an API that has accumulated so much
>>>> legacy cruft, that you are left with an old class where every single
>>>> member is deprecated, yet the class itself is still needed in the newer-
>>>> style calls.
>>>
>>> That is also one of Roland's pet peeves.
>>
>> Now try parsing JSON using the supplied builtin Java libraries
>> on Android. :-)
>>
>> There is a solution but it is not as clean as elsewhere.
>
> I would use binding instead of parsing.
>
> I have never done anything on Android, but I would
> expect both JSON-B and Jackson to work on Android
>
I like to avoid using third-party libraries when possible.
> JSON-B is:
>
> Jsonb b = JsonbBuilder.create();
> X o = b.fromJson(jsonstr, X.class);
>
> Jackson is:
>
> ObjectMapper om = new ObjectMapper();
> X o = om.readValue(jsonstr, X.class);
>
> It don't get much easier than that.
>
For comparison, here are the two built-in options available on Android
that I know about:
https://developer.android.com/reference/android/util/JsonReader
https://developer.android.com/reference/org/json/package-summary
Simon.
--
Simon Clubley, clubley at remove_me.eisner.decus.org-Earth.UFP
Walking destinations on a map are further away than they appear.
More information about the Info-vax
mailing list