xmlrpcwsc-dotnet
xmlrpcwsc-dotnet copied to clipboard
To Json
It would be really helpful if XmpRpcResponse.GetString() would return as valid json. The namespace / class name is used when values are of type Dictionary<string, object> in ObjectToString(object value) and the temp.Value is a List
var query = new List<string> { "name", "ilike", "fieldservice.task"};
var fields = new List<string> { "problems", "name" };
var list = response.GetObject() as List<object>;
var dict = list[0] as Dictionary<string, object>;
var problemIds = dict["problems"];
Perhaps a new method GetJson() would be a great enhancement?
My XmlRpcResponse.GetString() returns the following:
[{"problems": "System.Collections.Generic.List
1[System.Object]", "id": "3434", "name": "Engine / Exhaust System"}]`
Another workaround, for me, would be to modify the foreach loop in the ObjectToString method to test if the temp.Value is List
Hello,
I solved this issue converting the response XmlRpcResponse to a List<Dictionary<string,object>> List because Odoo could response a list and Dictionary for property value set.
With a bit of Refection and kept in mind the list of object could be only:
- list of int by example move_ids -> [1,2,3,44 ]
- list of a id and a name ref as company_id -> [ 18, 'IBM.t company' ]
Happy coding!