json.net

how to get all the array values for a given descendant in a Json

强颜欢笑 提交于 2019-12-11 05:17:27
问题 { "hasLoadMore": true, "groups": [ { "order": 0, "title": "string", "total": 0, "dateFormat": "string", "messages": [ { "commsId": 0, "commsDirectionCode": "string", "commsReasonCRSNN": 0, "commsDeliveryChannelCDCHN": "string", "commsDeliveryStateCode": "string", "commsDeliveryDttm": "2017-02-14T02:20:52.836Z", "commsSuccessFlag": true, "commsCode": "string", "commsName": "string", "commsRankingNumb": 0, "customerGrainCUSGN": 0, "productItemCode": "string", "sourceApplBAPPN": 0,

Silverlight File Not Found System.Runtime.Serialization on Deserialization from Newtonsoft

谁都会走 提交于 2019-12-11 05:09:38
问题 I am getting an exception when trying to deserialize JSON. It is my understanding that this file is provided by the Silverlight Runtime on the users local file system and should not need to be included in the the XAP files. T result = default(T); result = JsonConvert.DeserializeObject<T>(data); Any ideas as to why I am getting this error? Exception encountered: System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral,

How to get result from Cypher Query in json using Neo4j C# Client

六月ゝ 毕业季﹏ 提交于 2019-12-11 05:04:10
问题 i am using Neo4j 2.0.3 DB and using C# client to access neodb. I could not find any way by which after querying db i can get results in the form of Json. Please give me some links or examples 回答1: You can get Cypher Query results in JSON format eg. Consider a graph with person nodes and nodes have property personId. The below query will give you result in the form of json object. MATCH (n:PERSON)-[:friend]->(friend:PERSON) RETURN {personId: n.personId, friends: collect(distinct friend

Import Complex JSON file to C# dataTable

醉酒当歌 提交于 2019-12-11 04:56:15
问题 I have a .json file that has the following structure. { "$id": "1", "ACCOMODATIONs": [ { "$id": "2", "VOUCHER": { "$ref": "1" }, "ID": 3625, "VID": 872, "CHECKIN_DATE": "2017-02-06T00:00:00", "CHECKOUT_DATE": "2017-02-11T00:00:00", "HOTEL": "HOOT-8", "NIGHTS": 5, "ROOMTYPE": "Sharing", "PACKAGE": "ECONOMY", "HotelRemarks": null }, { "$id": "3", "VOUCHER": { "$ref": "1" }, "ID": 3626, "VID": 872, "CHECKIN_DATE": "2017-02-11T00:00:00", "CHECKOUT_DATE": "2017-02-21T00:00:00", "HOTEL": "HTWE-3",

How to write to a JSON file using C#?

时间秒杀一切 提交于 2019-12-11 04:47:21
问题 I want to be able to add users to a Users json file. I'm using Json.net to do this, anyone got any ideas of how I might go about doing this? 回答1: Here is a simple way of writing a JSON file in c# UserData user = Call Method Here string json = JsonConvert.SerializeObject(user, Formatting.Indented); File.WriteAllText(@"c:\user.json", json); This will write a simple JSON file and save it to your computer. 回答2: Assuming that you have to add users to an existing JSON file, the basic approach is:

Deserialize JSON array of different types [duplicate]

ε祈祈猫儿з 提交于 2019-12-11 04:46:44
问题 This question already has answers here : Deserializing polymorphic json classes without type information using json.net (5 answers) How to implement custom JsonConverter in JSON.NET to deserialize a List of base class objects? (8 answers) Json.Net Serialization of Type with Polymorphic Child Object (3 answers) Closed 9 months ago . Let's say I have the following JSON array: [ { "type": "point", "x": 10, "y": 20 }, { "type": "circle", "x": 50, "y": 50, "radius": 200 }, { "type": "person",

Write to JArray in JObject

こ雲淡風輕ζ 提交于 2019-12-11 04:45:44
问题 I have a JSON file. { "time": [ { "id": "9999", "name": "Foo", "subitem": [ { "name": "Bar", "id": "99990", "visible": true, "subitem": [ { "id": "999901", "name": "Flex", "visible": true }, { "name": "Bear", "id": "999902", "visible": true }, { "name": "James", "id": "999903", "visible": true } ] }, { "name": "Smith", "id": "999966", "visible": true }, { "name": "John", "id": "999933", "visible": true } ], "visible": true }, { "name": "Doe", "id": "1111", "visible": true, "subitem": [ {

JSON.NET's Deserializer's Converter selection is not polymorphic (uses declared type, not actual type) [duplicate]

China☆狼群 提交于 2019-12-11 04:44:16
问题 This question already has answers here : How to deserialize json objects into specific subclasses? (2 answers) Using custom JsonConverter and TypeNameHandling in Json.net (2 answers) Closed 2 years ago . I'm using Json.NET and setting TypeNameHandling to Object or All. When the deserializer is selecting a converter for an object, I'm finding it passes the declared type of the object to each JsonConverter's CanConvert, rather than the actual type (as described by the object's $type node). This

How do I convert an escaped JSON string within a JSON object?

白昼怎懂夜的黑 提交于 2019-12-11 04:43:39
问题 I'm receiving a JSON object from a public API with a property that, itself, is an escaped JSON string. { "responses":[ { "info":"keep \"this\" in a string", "body":"{\"error\":{\"message\":\"Invalid command\",\"type\":\"Exception\",\"code\":123}}" }, { "info":"more \"data\" to keep in a string", "body":"{\"error\":{\"message\":\"Other error\",\"type\":\"Exception\",\"code\":321}}" } ] } How do I convert this property into an actual JSON object (unescaped) in order to deserialize the entire

Self referencing loop Entity FrameWork

醉酒当歌 提交于 2019-12-11 04:42:29
问题 I'm currently using WebApi 2.0 and EntityFrameWork and I'm having issues with it: Self referencing loop detected for property 'UserInfo' with type 'System.Data.Entity.DynamicProxies.UserInfo_F7C6DF3909A804C5A9AC107297C8851F4CC9DF1CCA4A689B892B6C6EBA5A6EA8'. Path '[0].User'." my DB is something like this: User-UserInfo and is 1-1 relationship, the PK of User is the PF in UserInfo; public class User { public int UserId { set; get; } public string username { set; get; } public string password {