Not sure if that would make a difference, but have you tried setting returnXml=false on the RestExtensionMethod attribute. If that doesn't work, I'd look into returning a string as the result of the function call (for example, return a json representation of your document array, which you can easily consume from jquery)
/base not working wit array
Hi,
I have a method that return an Array of Document in my RestExtension and it's not working, anyone have an idea?
The result is : <value>umbraco.cms.businesslogic.web.Document[]</value>
I think it's a problem with the serialization of an array.
Thanks a lot!
Hi Vincent,
Not sure if that would make a difference, but have you tried setting returnXml=false on the RestExtensionMethod attribute. If that doesn't work, I'd look into returning a string as the result of the function call (for example, return a json representation of your document array, which you can easily consume from jquery)
Cheers,
/Dirk
I already try that, I decided to go with JSON and I don't have any problem now, thanks!
[RestExtensionMethod(returnXml = false)]
public static string BuildMainMenu()
{
return BuildMenu("showInMainMenu");
}
private static string BuildMenu(string property)
{
var headNode = new Document(NodeId);
var menuElems = new List<SerializableUmbracoMenuElem>();
var serializer = new JavaScriptSerializer();
if (headNode.getProperty(property).Value.ToString() == "1")
{
menuElems.Add(FillUmbracoData(headNode));
}
foreach (var topMenuNode in headNode.Children)
{
if (topMenuNode.getProperty(property).Value.ToString() == "1")
{
menuElems.Add(FillUmbracoData(topMenuNode));
}
}
return serializer.Serialize(menuElems);
}
is working on a reply...