Me encuentro trabajando con el editor WYSIWYG (http://demos.telerik.com/kendo-ui/editor/imagebrowser) de Kendo UI y para poder usar su imageBrowser requiero retornar datos en un JSON "limpio", es decir, con el siguiente formato:
Código:
pero mi web service (escrito en VB) me los retorna de la siguiente manera:[{"name":"cr1.jpg","type":"f","size":394875},{"name":"cr2.jpg","type":"f","size":370922},{"name":"cr3.jpg","type":"f","size":361742},{"name":"cr4.jpg","type":"f","size":404497}]
Código:
Este es el código de mi WebMethod<?xml version="1.0" encoding="UTF-8"?>
<string xmlns="http://tempuri.org/">[{"name":"cr1.jpg","type":"f","size":394875},{"name":"cr2.jpg","type":"f","size":370922},{"name":"cr3.jpg","type":"f","size":361742},{"name":"cr4.jpg","type":"f","size":404497}]</string>
Código:
Este es mi código JS: <WebMethod(enableSession:=True)> _
<ScriptMethod(ResponseFormat:=ResponseFormat.Json)> _
Public Function Read() As String
Dim tbl As New DataTable
Dim r As DataRow
tbl.Columns.Add("name", Type.GetType("System.String"))
tbl.Columns.Add("type", Type.GetType("System.String"))
tbl.Columns.Add("size", Type.GetType("System.Int32"))
Dim ruta As String = System.AppDomain.CurrentDomain.BaseDirectory() + "files\plantillas"
Dim folder As New DirectoryInfo(ruta)
For Each archivo As FileInfo In folder.GetFiles()
r = tbl.NewRow
r("name") = archivo.Name.ToString
r("type") = "f"
r("size") = archivo.Length
tbl.Rows.Add(r)
r = Nothing
Next
Return JsonConvert.SerializeObject(tbl)
End Function
Código:
Si alguno de ustedes sabe cómo podría hacer para que el JSON sea retornado como lo requiero le agradecería mucho su ayuda. $(document).ready(function() {
$("#editor").kendoEditor({
tools: [
"insertImage"
],
imageBrowser: {
messages: {
dropFilesHere: "Drop files here"
},
transport: {
read: "/miws.asmx/Read"
}
}
});
});
Quedo atento.
Muchas gracias.


