I have a list of object as IEnumerable<IHit<Header>>
, but .NET Core 3.0 is not emitting all information
this is when I return a single object IHit of the list obj.ElementAt(0)
{"explanation":null,"fields":null,"highlight":{},"id":"123","index":"ky","innerHits":{},"matchedQueries":[],"nested":null, "primaryTerm":null, "routing":null, "score":10.98915, "sequenceNumber":null, "sorts":[],"source":{"timeStamp":"2019-05-16T06:16:07Z", "result":"PASS","testTimeStart":"20190516141559","testTimeEnd":"20190516141607","barcode":"XXRX8762"},"type":"_doc","version":0}
but when I return the list itself:
[{"explanation":null,"fields":null,"highlight":{},"innerHits":{},"matchedQueries":[],"nested":null,"score":10.98915,"sorts":[]}]
also when I try explicitly to call JsonSerializer
string s = JsonSerializer.Serialize(result, typeof(IEnumerable<IHit<Header>>), obj);
To Wrap Up:
WebApi is working correctly and returning the object serialized correctly if a signle object:
public IHit<Header> Get(string id)
but when a list, then it is not.
public IEnumerable<IHit<Header>> GetAll()
I tried IEnumerable, IList, List
and all the same result!
- JsonSerializer is working neither with a single object nor with a list