Json format MetroLog for windows store app - windows

I'm using MetroLog framework for my App because i need to send the logs to my backend.
MetroLog has as target a JsonPostTarget
conf.AddTarget(LogLevel.Info, LogLevel.Fatal, new JsonPostTarget(1, new Uri("http://localhost:8080/logs/")));
The logs are wrapped inside an object and automatically serialized as in json format but not camelCase d.
So my backend can't deserialize properly the object.
I can't touch the deserialization for the backend so i need a way to force the camelCase serialization.
Can somebody help me ?

I can't touch the deserialization for the backend so i need a way to force the camelCase serialization.
You could use JSON.NET to serialize the object in camelCase format.
Run the following command to install Newtonsoft Json.NET and using NuGet library
PM> Install-Package Newtonsoft.Json
You can create a JsonSerializerSetting to Serialize the object with JsonConvert and return the content with content type application/json. Then you will get the object in camelCase Json format.
For more details, you might refer to the blog written by #Mats Karlsson.

Related

How To Store Data On Icloud in xamarin form.ios

enter image description hereThis Below my data I want to store on IClouds IOS, How Can I do that ,is it possible to store on iClouds ,please give me a code for that
enter image description here
This Below my data I want to store on IClouds IOS, How Can I do that ,is it possible to store on iClouds ,please give me a code for that
To save the "MyFun item" data, it is recommended to serialize the data and save it to a json file or an xml file.
For JSON serialization, you can install the Nuget package Newtonsoft.Json. For more info, you can refer to this document.
Or XML serialization, you can create an instance of XmlSerializer Class to serializes and deserializes objects into and from XML document.
Here are some related SO threads you can refer to.
How to write a JSON file in C#?
Serialize an object to XML
If you have got the serialized data, as mentioned in the comment, you can download official demo Xamarin.iOS - Introduction to iCloud, then pass it to MonkeyDocument.DocumentString.

How to load json api into database using talend

I am new in Talend. this is my api => http://api.dss.adapt-odisha.com/aagro?url=https://mausam.imd.gov.in/api/warnings_district_api.php
this is created design =>
in tXMLMap
But when i am running this i am not getting data
How can i solve this issue?
Your api returns a json, but tRESTClient converts it to xml by default, because of "Convert response to DOM Document" setting.
I unchecked that setting, and used tExtractJSONFields to parse the json, it's working as expected.
Here's the schema of tExtractJSONFields

Make json the default formatter in asp.net web api 2

In my web api I allow the user to specify how they want their data via an extension: ie. host/api/location/getmyhouse.json or getmyhouse.xml.
However I also have actions that aren't get and they return if the action was successful or not. For that it doesn't really make sense to specify the return type so I was trying to have it just default to json. However by default it seems xml is used.
Is there a way to default the formatter to json vs xml without removing xml as a formatter AND without having the client specify it as I want this to be done via simple url in the browser. It's an internal thing so that's what we would like.

De-serialization without protobu

Using protobuf I am able to serialize data. I need to send this serialzed packet to different location. As I know I need protobuf again to de-serialize the data.
Is there a way in which we can de-serialize data without using full protobuf library or maybe a minimum version of protobuf.
TIA...
Once you have generated the serialization and deserialization code you don't need the protoBuff library. The ParseFromIstream() method is all you need.
From what I've read you never actually import Protobuf, you just run it to generate code that is dropped into the project. The generated code does not require the program that generated it.

Odata endpoint returning 404 bad request when the "$" in filter is encoded

I have an Azure Mobile service with a .Net back end.
In the backend the data object use proper case. for example, MemberNumber.
In the azure client the view models use pascal case memberNumber.
I am using a library that creates an ODATA request and I get:
The query specified in the URI is not valid. Could not find a property named 'memberNumber' on type 'arenaapi.DataObjects.Members'.
That happens with this get:
/tables/members?%24inlinecount=allpages&%24orderby=memberNumber
If I change that the MemberNumber it works.
However, also, if I change the request to:
/tables/members?%24inlinecount=allpages&$orderby=memberNumber
It also works. It seems that the model binding parser is working differently if the $ is encoded or not.
Is there any way I can fix this server side so the encoded request won't return a 400 without changing the memberNumber to MemberNumber?
All the other stuff, posting, patching, etc is properly binding the pascal cased JSON post to proper cased c# data objects.

Resources