The easiest way to solve this would be to use either a custom class or a dynamic one when you serialize:
var folder = _sitecoreContext.GetItem<ISomeFolder>(dataSourceId)
var list = folder.SubItems;
var json = JsonConvert.SerializeObject(list.Select(subitem => new
I have faced the same issue during the implementation of Display custom facet on the Experience profile tab. @x3mxray helped me as well to implement the same.
As per the article
you followed, the controller will return your facets values, but it's not serialized so you will ...
Your issue is that each facet has an XObject object on it that contains a lot of circular references. The XObject will never serialize, you just need to tell NewtonSoft to ignore it when serializing. You can do this with a DefaultContractResolver.
You can see this working in my repo. https://github.com/buildabonfire/Bonfire.Analytics.Dto
Your facets will ...
Adding in an answer as I can't add json properly in the comments, can you try with the following?
No, you won't get the results count in JSON Results response. Search Results and JSON Results responses are completely different things.
In order to do that, you would need to make some modifications to RenderJsonVariantList method in Sitecore.XA.Foundation.JsonVariants.Extensions.JsonVariantsExtensions.
copy the JSON Results rendering and ...
It seems that you try to return Sitecore.XConnect.Facet in server response to browser. Facet is a complex model with generic self-referenced properties.
Try to create a simple class for view model only with fields that you need on client side, populate them from facet and use it for server response instead of Facet model.
I have also faced this issue when ...