Tagged Questions
0
votes
2answers
14 views
JSON response structure issues c#
I have to return a JSON string in a c# API which follows like:
{
"model" : 4 ,
"lang" : "en_US",
"parts" :
[
{
"id" : 1545,
"name" : ...
0
votes
1answer
28 views
Need help replacing parts of json string with regex
How can I replace the following using Regex.Replace in my c# application?
Replace all of the following:
rendition\":{
with:
rendition\":[{
So i am adding the left square bracket.
and also
...
1
vote
1answer
37 views
Can't serialize an object with Json.Net
I have the following object and I am trying to serialize it to Json with Json.NET
[Serializable]
public class FlightSelection : IEquatable<FlightSelection>
{
public static readonly DateTime ...
0
votes
0answers
28 views
How to serialize as Json an object structure with circular references?
I have an object structure like this:
public class Proposal {
public List<ProposalLine> Lines { get; set; }
public string Title { get; set; }
}
public class ProposalLine {
public ...
1
vote
1answer
45 views
InvalidCastException mapping Json string onto Guid property
Having theese POCOs:
public class UserRegistration
{
[Required]
public ApiKey ApiKey { get; set; }
...
}
public class ApiKey
{
[Required]
public Guid AppKey { get; set; }
...
1
vote
1answer
27 views
How to handle spaces in JSON keys when serializing to XML?
I'm using Json.NET in a .NET 4.0 application in order to convert a JSON RESTful response into XML. I am running into issues converting JSON into XML if a JSON child key has a space.
So far, I am able ...
0
votes
1answer
32 views
Calling methods from .ashx handler from aspx.cs page
I'm having a bit of trouble calling a method from a generic handler we have. I've tried using two separate techniques to call a simple 'HelloWorld()' method but I get two different errors:
The first ...
0
votes
1answer
31 views
Puzzled by RavenDB 'Raven.Imports.Newtonsoft.Json.JsonSerializationException'
I initialize my RavenDB DocumentStore like this:
void InitializeDocumentStore( string address )
{
_documentStore = new DocumentStore()
{
Conventions =
{
...
-1
votes
1answer
23 views
Json stream parser in C# for windows phone
I am building a wp7 application.I want to parse JSON string coming from a continuous tcp stream.I want a json parser which can parse from a stream.Is there any SAX JSON parser to parse from a stream.I ...
3
votes
2answers
35 views
Json Parsing in c# using Json.Net
{"Posts":
[{"id":"1",
"title":"Bibidh prothom khondo",
"content":"sjih sdkljjdsf kdjsfjks",
"author":"","last_update":"23 june 2013",
...
1
vote
1answer
33 views
Json.NET to list of class as attribute
I build a rest service which output are json. I using Newtonsoft.Json.
This is my class.
public class DownloadPDA
{
public List<FRUTE> lsRute { get; set; }
public List<FCUSTMST> ...
0
votes
0answers
14 views
How to convert single element in XML to an error while using Newtonsoft JSON convert
In my c# program I am using Newtonsoft to convert an xml to json.
I would like to convert a single node(version) from the following XML to an array since in most cases there are multiple nodes. When ...
1
vote
1answer
38 views
c# deserializing text with guids to json
I get the following json from a service contract (solr)
{"highlighting":{
"394c65f1-dfb1-4b76-9b6c-2f14c9682cc9":{
"PackageName":["- <em>Testing<em> channel twenty."]},
...
3
votes
1answer
34 views
Json Deserialization, Create duplicate objects
It's easier to show a mock up of the problem rather than trying to explain it first.
internal class Program
{
private static void Main(string[] args)
{
Class1 class1 = new Class1() { ...
-1
votes
1answer
23 views
Json string Deserialisation in silverlight
I have a json string Like this:
{"0":{"City_Id":"2","City_Name":"Agra"},"1":{"City_Id":"3","City_Name":"Ahmedabad"}}
I want to deserialise it in c# by any means possible.(Note: for silverlight ...
3
votes
3answers
67 views
Linq query JObject
I am using Json.net for serializing and then making an JObject that looks like this:
"RegistrationList": [
{
"CaseNumber": "120654-1330",
"Priority": 5,
"PersonId": 7,
...
9
votes
3answers
99 views
Is there any way to change date time formatting in JSON?
I'm using JSON to send data to client. However, the date fields get transformed into a timespan format like /Date(1363807800000)/.
Is there anyway to get rid of it and let server send DateTime values ...
-3
votes
0answers
25 views
how to extract json data in windows form application c#.net? [on hold]
I have following json data:
{"Movies":[{"Movie":
{"id":"21",
"name":"BombayTalkies",
...
1
vote
2answers
34 views
Cannot deserialize the current JSON array (e.g. [1,2,3]) into type
I have a class like this;
public class MyStok
{
public int STId { get; set; }
public int SM { get; set; }
public string CA { get; set; }
...
0
votes
0answers
15 views
asp.net 3.5 JSON post with empty body 400 error
I am working on a website that uses the JSON FlexMLS API and am having trouble getting my session token for authorization. I am using the Spark API authentication method with documentation here: ...
1
vote
2answers
37 views
SelectList in MVC incorrect syntax
What am I doing wrong here?
What I am trying to do is populate a list of Function Value and function Name into a jSon result that I will then use on my main page with jQuery.
The error is:
...
1
vote
3answers
57 views
Deserialize the JSON where the values are field names with JSON.NET
I have a very undesirable situation which requires me to deserialize the JSON where the values are field names with JSON.NET. Assuming that I have the following JSON which is very properly structured:
...
2
votes
2answers
59 views
Prblem in Deserialization of JSON
My project gets a lot of JSON strings via UDP, each string describing some list of objects.
I could'nt write a function that get a some list, and make Derialization to this list.
The problem is that I ...
0
votes
1answer
55 views
Read contents JSON file sitting on webserver from c# code behind
I am trying to read the contents of a JSON file sitting in my github pages repository.
I can navigate and see the file contents in my browser if I specify the url.
If I use the code here:
...
0
votes
1answer
26 views
How to get json result value, returned by controller post action, after data was posted via form, generated by Ajax.BeginForm?
Well, I have ajax post form in my view with declared OnComplete javascript handler function name:
Model
class MyModel
{
public string Prop1 { get; set; }
public string Prop2 { get; set; }
}
...
-2
votes
1answer
68 views
How to convert a dictionary pair.value to a dictionary in C#?
i have the following JSON in my application.
string json = @"{""dest"":[ { ""mode"": ""1"", ""test"":""test1,test,test2""},{ ""mode"": ""2"", ""test"": ""test3"" }]}";
To get the value of dest I m ...
0
votes
1answer
33 views
Deserializing JSON with different types for serialization/deserialization
I have a class:
[DataContract]
public class A
{
[DataMember]
public B ArbitraryProperty { get; set;}
}
When serialized, "ArbitraryProperty" needs to be in the form of class "B":
...
0
votes
0answers
11 views
Serialize/deserialize a DataTable to bson via Newtonsoft
I'm trying to serialize/deserialize a DataTable to bson using the following two utility methods (Nerwtonsoft.Json). The serialization seems to work, but the de-serialization results in an empty ...
-5
votes
0answers
48 views
how to decode JSON data in windows form application? [closed]
how to decode following JSON data:
string json = @"{
""Movie"":{
""id"":102,
""name"":[""Aashiqui2"",""yeh jaawani hai ...
1
vote
2answers
48 views
Parsing JSON string into string in C# using JSON.NET
This is my first little project on C# and JSON. I'm asked to parse a JSON file into the following:
I'm trying to create a windows form whose body will contain the content of a JSON string in the ...