Is it possible to programmatically extract the content of all RTE fields within a Grid editor? For this use-case, I need to do so against an IContent object.
If I know the config in advance, I can always convert the string value to a JSON object and step through that, but what I need to be able to extract all the RTE content without knowing the data structure.
You could just parse the property value as a JSON object and use some JsonPath to select all elements where the editor alias is rte. Then loop through that list and get the value for each element.
Extract RTE content from Grid editor
Is it possible to programmatically extract the content of all RTE fields within a Grid editor? For this use-case, I need to do so against an IContent object.
If I know the config in advance, I can always convert the string value to a JSON object and step through that, but what I need to be able to extract all the RTE content without knowing the data structure.
Possible? Plausible?
You could just parse the property value as a JSON object and use some JsonPath to select all elements where the editor alias is
rte
. Then loop through that list and get the value for each element.How did I not know about JsonPath? Must have been living under a rock...
Should do the trick, I think. Thanks.
is working on a reply...