jdevillard / JmesPath.Net

A fully compliant implementation of JMESPATH for .NetCore

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

'JmesPath.Transform(JToken, string)' is obsolete warning

Thaina opened this issue · comments

public String Transform(string json, string expression)
{
var token = ParseJson(json);
var result = Transform(token, expression);
return result.AsString();
}

var result = parser.Transform(document, expression);

These lines just trying to use obsolete function itself. Is it right?

Yes that is right.
We are trying to deprecate using this Transform overload, in favour of one that takes a string instead of a JToken. The reasons for that are that :

  • By performing the conversion from text to a JToken we drive the date/time conversion ourselves. Which allows us to use the various comparison operators in the JmesPath expression.
  • Ultimately, we would like the public interface to not have a direct dependency over Newtonsoft.Json, perhaps allowing us to replace the JSON library in the future.

@springcomp I mean, it intend to be deprecated but it still being used internally so it caused warning. So I am not sure if it really alright to ignore those warning when build the library

You can ignore the warning.
In fact, it is not used internally.
Only the compliance tool uses this overload. But the tool is not a deliverable. Besides, it can easily be adapted, but I just did not take the time to it.

Hi! We have a case where we need to perform a lot of transformations on the same input, so it looks like if we use string as input it will deserialize it each time… will this negatively impact performance? Thanks!