I have a dynamic data model, that requires me to access this class, to perform additional logic before it gets served to the client app. Currently its set to Internal and, thus inaccessible to my implementation and makes thing like dynamic data models somewhat tricky...
public Dictionary<string, object> Attributes { get; set; }
In my service where the documents get created... I can construct something to the effect of
Attributes: {
"foo":"bar",
"something": [ "23432", "dsfdsf", "12321" ],
// at any given time my source system could add other arrays/text items
}
During deserialization, I'm unable to do something like this for example
if (value is Nest.Json.Linq.JArray collection) // <----- this complains.
{
value = collection.ToArray<string>();
}
I've tested the above successfully in a sample app, where I emulated this functionality using NewtonSoft.JArray, but of course that doesn't help me much :P
Without the above, the array items get rendered like this in the client:
Attributes: {
"foo":"bar",
"something": [ [], [], [] ],
}
I'm open to suggestions, but failing the above, could we please update the Nest.Json.Linq.JArray to be Public?
These types are our internalized JSON.NET types where we rewrote the namespace to Nest.Json they are very much intentionally not public, have a gander at our release blog post for the back story here :smile:
https://www.elastic.co/blog/nest-elasticsearch-net-6-0-ga
If you need this types public its best to switch to the Nest.JsonNetSerializer package and configure the client to use it
This way you will get back public Newtonsoft.Json.Linq.JArray's instead 馃憤
Most helpful comment
These types are our internalized JSON.NET types where we rewrote the namespace to
Nest.Jsonthey are very much intentionally not public, have a gander at our release blog post for the back story here :smile:https://www.elastic.co/blog/nest-elasticsearch-net-6-0-ga
If you need this types public its best to switch to the Nest.JsonNetSerializer package and configure the client to use it
This way you will get back public
Newtonsoft.Json.Linq.JArray's instead 馃憤