I need to create a new content type in orchard cms that will only have a field indicating a json url to be consumed. My question is how to consume json in content-type and return the data consumed. Thanks
Asked
Active
Viewed 289 times
1 Answers
1
You need to issue a web request using eg. RestSharp (or built-in WebClient class) and return deserialized data. RestSharp already has a JSON deserializer built-in, but if you need more robust solution you can use JSON.NET.
The request would be best done in one of the content part handler events (eg. OnLoaded
) - just set a value of some property on your custom part to the returned data from there.

Community
- 1
- 1

Piotr Szmyd
- 13,371
- 6
- 44
- 61
-
ok, thank you. I just need to know how to do that in orchard cms – Luiz Alegria Sep 27 '13 at 14:39
-
what do you think about create a new module to do this? – Luiz Alegria Sep 27 '13 at 15:01