Exporting Component values as JSON | Community
Skip to main content
Level 2
Sep 21, 2023 12:13 PM UTC
Solved

Exporting Component values as JSON

We tried to export component values using @Model(adaptables = Resource.class, resourceType = {
"/components/content/carousel" }, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL, cache = false)
@3484101(name = "jackson", extensions = "json", options = {
@ExporterOption(name = "SerializationFeature.WRITE_DATES_AS_TIMESTAMPS", value = "true")}) to a JSON format, however we are able to see the JSON values in author and publisher instances, but on dispatcher URL when we try to access this JSON, it is giving us the content as html format.

How to access this JSON values from dispatcher URL as JSON format.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Jagadeesh_Prakash
Jagadeesh_PrakashAccepted solution
New Participant
Sep 21, 2023 1:30 PM UTC

@harinivr  how are you accessing the URL in author and publisher. Is it as part of selector?

 

If yes then use below filter rules to allow model json 

/0101 { /type "allow" /extension "json" /selectors "model" /path "/content/*" }

4 replies

kautuk_sahni
Employee
Sep 26, 2023 7:26 AM UTC

@harinivr Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.

Translate
Kautuk Sahni
Preetpal_Bindra
New Participant
Sep 21, 2023 10:01 PM UTC

Hello @harinivr ,

Would you have URL examples that you could possibly share and/or screenshots from your test? You can mask out sensitive info.

Also, when you at it, can you also share the screenshot of the network request from the browser's dev tools?

 

thanks,

Preetpal

Translate
Jagadeesh_Prakash
Jagadeesh_PrakashAccepted solution
New Participant
Sep 21, 2023 1:30 PM UTC

@harinivr  how are you accessing the URL in author and publisher. Is it as part of selector?

 

If yes then use below filter rules to allow model json 

/0101 { /type "allow" /extension "json" /selectors "model" /path "/content/*" }
Translate
Ankur_Khare
New Participant
Sep 21, 2023 12:47 PM UTC

Hi,

I would suggest to refer one of the core component it would be working with dispatcher as well and follow the similar steps.

 

Regards

Ankur

Translate