question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TreeTraversingParser#readValueAsTree returns whole tree instead of current node

See original GitHub issue

If you create a TreeTraversingParser on a node, say on {"b": {"bValue" : 1}} and have classes like:

class A {
  B b;
}

@JsonDeserialize(using = B.Deserializer.class)
class B {
  static class Deserializer extends JsonDeserializer<Expression> {
    @Override
    public Expression deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
      JsonNode jsonNode = p.readValueAsTree();
    }
  }
}

then you would expect jsonNode to represent {"bValue" : 1}, but instead it is the whole original tree ({"b": {"bValue" : 1}}).

The method p.currentNode returns the correct value, but is protected.

Could TreeTraversingParser override readValueAsTree and return currentNode instead of the current behaviour?

(I’ve tried to extract this example from more complex code, but I think the essence is correct. I can produce a minimal test case if that would help repro this.)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
cowtowncodercommented, Mar 15, 2018

@robinkanters lol. Sorry about that. Auto-completion fail for some reason. 😃

0reactions
robinkanterscommented, Mar 15, 2018

@cowtowncoder thanks for the tag but that wasn’t me

@robinmessage

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I return a boolean while traversing a BinaryTree ...
It prints out false, although the Tree has a Node with Value of 40. My Console looks like this after running it: Value...
Read more >
Check whether a binary tree is a complete tree or not
If the current node under examination is NULL, then the tree is a complete binary tree. Return true. If index (i) of the...
Read more >
ast — Abstract Syntax Trees — Python 3.11.1 documentation
keys and values hold lists of nodes representing the keys and the values respectively, in matching order (what would be returned when calling...
Read more >
sklearn.tree.DecisionTreeRegressor
If None, then nodes are expanded until all leaves are pure or until all ... the total number of samples, N_t is the...
Read more >
Simply Scheme: Introducing Computer Science ch 18: Trees
The big advantage of full-featured lists over sentences is their ability to represent structure in ... Datum of a tree node returns the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found