I have all values from aspx page. now I want to prepare following json values by picking up from the control values of aspx where user has inputted and want to submit to other application in same format.For that below is the example I want to make exact copy as like below.
var tempk = {
"requestTypeCode": "PRE_DETERMINATION",
"billingProvider": {
"npi": "1234567893",
"ein": "111222333",
"payerAssignedProviderId": "XYZ321"
},
"patient": {
"relationshipCode": "01",
"lastName": "Smith",
"firstName": "Bob",
"stateCode": "FL",
"birthDate": "1980-02-12",
"genderCode": "M"
},
"payer": {
"id": "BCBSF"
},
"submitter": {
"id": "123456789",
"lastName": "SUBMITTER"
},
"subscriber": {
"memberId": "JDH001",
"groupName": "ASDF 1-2",
"groupNumber": "12312412"
},
"claimInformation": {
"placeOfServiceCode": "11",
"diagnoses": [
{
"qualifierCode": "ABK",
"code": "J3089"
}
],
"serviceLines": [
{
"procedureCode": "92523",
"quantity": "100",
"amount": "250",
"fromDate": "2016-05-10"
}
]
}
}
Can you assist me how with the C# code will achieve?
You can use Newtonsoft.Json from nuget
http://www.newtonsoft.com/json
Related
Im using C# to write GraphQL queries and execute them
i created the schema and everything works fine i get the data back exactly as i want,
but the first letter of the name of the properties gets changed from a capital letter to a small letter.
this is my schema code,
var schema = Schema.For(#"
type user {
Indx: Int,
UserName: String,
Password: String
}
type Query {
users: [user]
}
",s=>s.Types.Include<Query>());
this is the execution code, this execution method works fine returns all the data i want from my tables but instead of returning property names with first letter capitalized it returns property names with first letter small.
var json = schema.ExecuteAsync( s => { s.Query = "{ users {indx,userName,password} }"; });
this is the result I get:
{
"data": {
"users": [
{
"indx": 593,
"userName": "string",
"password": "string"
},
{
"indx": 540,
"userName": "new test user",
"password": "1234"
},
{
"indx": 598,
"userName": "wolv",
"password": "1234"
}
]
}
}
if i change the execution to as follows :
var json = schema.ExecuteAsync( s => { s.Query = "{ users {Indx,UserName,Password} }"; });
i get an error in return:
{
"errors": [
{
"message": "Cannot query field \u0027Indx\u0027 on type \u0027user\u0027. Did you mean \u0027indx\u0027?",
"locations": [
{
"line": 1,
"column": 10
}
],
"extensions": {
"code": "FIELDS_ON_CORRECT_TYPE",
"codes": [
"FIELDS_ON_CORRECT_TYPE"
],
"number": "5.3.1"
}
},
{
"message": "Cannot query field \u0027UserName\u0027 on type \u0027user\u0027. Did you mean \u0027userName\u0027?",
"locations": [
{
"line": 1,
"column": 15
}
],
"extensions": {
"code": "FIELDS_ON_CORRECT_TYPE",
"codes": [
"FIELDS_ON_CORRECT_TYPE"
],
"number": "5.3.1"
}
},
{
"message": "Cannot query field \u0027Password\u0027 on type \u0027user\u0027. Did you mean \u0027password\u0027?",
"locations": [
{
"line": 1,
"column": 24
}
],
"extensions": {
"code": "FIELDS_ON_CORRECT_TYPE",
"codes": [
"FIELDS_ON_CORRECT_TYPE"
],
"number": "5.3.1"
}
}
]
}
I want the data to be returned like this:
{
"data": {
"users": [
{
"Indx": 593,
"UserName": "string",
"Password": "string"
},
{
"Indx": 540,
"UserName": "new test user",
"Password": "1234"
},
{
"Indx": 598,
"UserName": "wolv",
"Password": "1234"
}
]
}
}
any ideas ?
Delete a specific node from all the available documents in a bucket
Is it possible to delete an element from the children array based on the Id from the below sample document using .NET SDK for Couchbase in C#?
i.e. I need to delete all the details of Id=100( delete the entire element in the children array).
I can achieve it using N1QL. N1QL performance is slow when there are thousands of document involved in couchbase
{
"results": [{
"tutorial": {
"type": "contact",
"title": "Mr.",
"fname": "Ian",
"lname": "Taylor",
"age": 56,
"email": "ian#gmail.com",
"children": [{
"Id": "100",
"Details": [{
"fname": "Abama",
"age": 17,
"gender": "F"
}]
},
{
"Id": "101",
"Details": [{
"fname": "Alex",
"age": 17,
"gender": "M"
}]
}
],
"hobbies": [
"golf",
"surfing"
],
"relation": "cousin"
}
}]
}
I'm trying to query DocumentDB by the following attribute
"Loop": [
{
"#LoopId": "0204",
"#Name": "Order Information Detail",
"OID": {
"OID01": null,
"OID02": "1NN***"
}
},
{
"#LoopId": "0210",
"#Name": "Quantity Information",
"QTY": {
"#comment": [],
"QTY01": {
"#text": "H9"
},
"QTY02": "10",
"QTY03": null,
"QTY04": "Pallets"
}]
using the Query
SELECT * FROM c WHERE c.Loop[0].OID.OID02="1NN***";
however the same document has another attribute Loop in it:
"Loop": [
{
"#LoopId": "0100",
"#Name": "Party Identification",
"N1": {
"#comment": [],
"N101": {
"#text": "CA"
},
"N102": "BN*********",
"N103": {
"#text": "2"
},
"N104": "B***"
}
},
{
"#LoopId": "0100",
"#Name": "Party Identification",
"N1": {
"#comment": [],
"N101": {
"#text": "SF"
},
"N102": "*****"
}]
is there anyway around this because I need to get the information by OID
thanks in advance
Can you try doing this query, as I think each "row" in the Loop array is a different Loop object:
SELECT * FROM Loop c WHERE c.OID.OID02 = "1NN***";
I want to extract all IDs from the below object using c#.
in need of extracting a response value in a visual studio webtest.
The JSON is obtained using extract event.
{
"d": [
{
"__type": "QuestionZoneEditor.Entities.QuestionTag",
"Id": 2080,
"Name": "01",
"Items": [
"1a",
"1b",
"1c",
"1d"
]
},
{
"__type": "QuestionZoneEditor.Entities.QuestionTag",
"Id": 2081,
"Name": "02",
"Items": [
"2a(i)",
"2a(ii)",
"2b",
"2c"
]
},
{
"__type": "QuestionZoneEditor.Entities.QuestionTag",
"Id": 2082,
"Name": "03",
"Items": [
"3a",
"3b",
"3c"
]
}
}
]
}
Deserialize it to JObject after that take all JObject from the JArray and print the Id
var result = JsonConvert.DeserializeObject<JObject>(json);
foreach(JObject obj in result["d"])
{
Console.WriteLine(obj["Id"]);
}
Full example: dotNetFiddle
I have a JSON string that I'm getting from Facebook API, in which I have a node whose name changes according to its content, for example some time it is 45, or 58 etc.
It could be any number.
I want its value. How to get it?
Example:
{
"data": [
{
"id": "1492292372_10201810786059989",
"created_time": "2014-04-05T09:00:54+0000"
},
{
"id": "1492292372_10201804679827337",
"created_time": "2014-04-04T07:29:07+0000"
},
{
"id": "1492292372_10201804649306574",
"created_time": "2014-04-04T07:10:33+0000"
},
{
"id": "1492292372_10201801316823264",
"created_time": "2014-04-03T18:31:50+0000"
},
{
"id": "1492292372_10201798962284402",
"created_time": "2014-04-03T06:24:47+0000"
},
{
"message_tags": {
"0": [
{
"id": "1492292372",
"name": "Yawar Sohail",
"type": "user",
"offset": 0,
"length": 12
}
],
"15": [
{
"id": "1489845168",
"name": "Zeeshan Anjum",
"type": "user",
"offset": 15,
"length": 13
}
]
},
"id": "1492292372_10201796274777216",
"created_time": "2014-04-02T17:57:05+0000"
},
{
"id": "1492292372_10201794080482360",
"created_time": "2014-04-02T07:26:23+0000"
},
Inside message_tags there are two nodes [0 and 15] they dynamically changes according to their offset values. I want names, type and ids inside these nodes.
You can deserialize your JSON into an ExpandoObject:
var converter = new ExpandoObjectConverter();
dynamic obj = JsonConvert.DeserializeObject<ExpandoObject>(json, converter);
Which dynamically adds members to your object at runtime, and allows you to iterate over them as described in this answer:
foreach (var prop in obj.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public))
{
Console.WriteLine("Name: {0}, Value: {1}",prop.Name, prop.GetValue(obj,null));
}
That way you can iterate over obj.message_tags to get the individual messages, and obtain all their details respectively.