NeoJSON icon indicating copy to clipboard operation
NeoJSON copied to clipboard

Add functionality to only return values for a property or a JSONPath. Be able to deserialize those values as a specified schema.

Open botwhytho opened this issue 1 year ago • 1 comments

Consider integrating extension methods defined in BotwhythoGtExtensions package.

They enable parsing only a JSONPath while 'throwing out' unwanted data, all without having to create 'dummy' wrapper classes (potentially multiple layers of these) with mapping definitions when one only wants a leaf value.This is rather onerous if working with many ever changing third party data sources where one can't control the shape of the response.

The package adds the following extension methods:

  • NeoJSONReader>>#onlyParseProperty:: Only return the value of a single top level property of a JSON object.
  • NeoJSONReader>>#onlyParseProperty:as: Same as previous, but specifying a schema for the value.
  • NeoJSONReader>>#onlyJSONPath:: Return the whole path of objects, basically nested map classes with only one key/value pair until the 'leaf' object is reached.
  • NeoJSONReader>>#onlyJSONPath:as:: Same as previous, but specifying a schema for the value.
  • NeoJSONReader>>#onlyJSONPathLeafValue:: Return only the leaf object of interest without the intermediary path.
  • NeoJSONReader>>#onlyJSONPathLeafValue:as:: Same as previous, but specifying a schema for the value.
  • NeoJSONReader>>#normalizeIntoCollection:: Helper method to normalize parameters

botwhytho avatar May 01 '24 19:05 botwhytho

@svenvc any thoughts on the above?

botwhytho avatar May 06 '24 22:05 botwhytho