other-languages

here be heresies and things we have to use for work
teodorlu 2021-05-14T12:56:43.125800Z

Does jackson (Java) provide a get-in equivalent for lookup on a JsonNode?

teodorlu 2021-05-15T10:37:29.126600Z

In case anyone else are interested, I just wrote it out:

JsonNode current = this.provideJson.get();

        for (String k : key) {
            if (current.hasNonNull(k)) {
                current = current.get(k);
            } else {
                return Optional.empty();
            }
        }

        if (current.isInt())
            return Optional.of(current.asInt());
        else
            return Optional.empty();
Quite straightforward.

teodorlu 2021-05-15T10:38:01.126800Z

Different methods for different types. I didn't bother with generics.

osi 2021-05-15T20:24:47.127Z

JsonNode#at is it’s built-in equivalent

1đź’Ż1
teodorlu 2021-05-16T13:05:39.127400Z

Thanks!

raspasov 2021-05-14T13:15:59.126100Z

JetBrains editors have “Extend Selection” + cut/copy/paste and it is a reasonable compromise. It’s not real structural editing, but you get perhaps ~50% of the same effect.

raspasov 2021-05-14T13:17:21.126400Z

I had to write a bit of Swift and Xcode does not have “Extend Selection” or anything similar. I used JetBrains AppCode, which does. I recommend it for Swift/Objective-C.