javascriptserializer Questions

21

I am using .NET JSON parser and would like to serialize my config file so it is readable. So instead of: {"blah":"v", "blah2":"v2"} I would like something n...
Biologist asked 18/4, 2010 at 3:54

18

Every object I return from a WebMethod of a ScriptService is wrapped into a JSON object with the data in a property named d. That's ok. But I don't want the additional __type property to be served ...
Argot asked 9/3, 2009 at 17:59

8

Solved

I am trying to use JavaScriptSerializer in my application. I initially received Cannot find JavaScriptSerializer and I solved it by adding: using System.Web.Script.Serialization; But then...
Vinegarish asked 23/10, 2012 at 16:34

31

Solved

I have a class that contains an enum property, and upon serializing the object using JavaScriptSerializer, my json result contains the integer value of the enumeration rather than its string "...
Boren asked 14/3, 2010 at 5:18

5

My service method: [WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public string getDataFromTrainingMaster() { List<TrainingMasterDataStruct> results = new DAL().GetDataFro...
Bertle asked 19/2, 2013 at 5:37

2

How can I do this in C# modern UI ? var url = "http://ajax.googleapis.com/ajax/services/feed/load?q=http%3A%2F%2Fwww.digg.com%2Frss%2Findex.xml&v=1.0"; var wc = new WebClient(); var rawFeedDat...

4

Solved

I have installed c# support for vscode(version is 1.15.0) and created a HelloWorld project via dotnet new console. Now in Program.cs, I would like to use JavaScriptSerializer class which depends ...
Flaxseed asked 15/8, 2017 at 6:56

4

Solved

I have the following method: using System.Web.Services; using System.Web.Script.Services; using System.Web.Script.Serialization; using Newtonsoft.Json; using System.Collections; [WebService(Names...
Eer asked 24/10, 2013 at 10:39

0

I have an enum declared in c#. I have a Display Name/ EnumMember value annotation and Student Class. I'm using asp.net core 2.2+ version with Odata. [DataContract] Public Class Library { public i...
Quadrivial asked 2/6, 2020 at 11:8

3

Solved

I have this C# object: var obj = new { username = "andrey", callback = "function(self) { return function() {self.doSomething()} (this) }" } I need to JSON serialize it to pass to the browser i...
Corri asked 21/3, 2011 at 3:29

2

Solved

I am serializing a complex object with lot of properties of other Types and Lists to JSON form but the issue is with DateTime properties. I get the epoch time with JavascriptSerializer (rather than...
Mccallum asked 28/10, 2010 at 17:49

5

Solved

I'm trying to use the JavascriptSerializer object in ASP.NET v4.0 with C#. I'm not using Visual Studio--this is on a live IIS7 server. I can access this object just fine using VB on this same web s...
Guinness asked 4/4, 2013 at 17:51

6

Solved

I'm not sure where I'm going wrong of what I'm missing. I'm building an ASP.NET 2.0 (on the .Net 3.5 framework) Web application and I am including a webservice. Note that this is not an MVC projec...
Welltodo asked 13/1, 2010 at 16:39

1

I´m writing a script in powershell 2.0 and an upgrade to 3.0 or higher is not possible right now. In this script I try to serialize some data to JSON with the code from this link (PowerShell 2.0 Co...
Physiological asked 26/8, 2016 at 8:29

5

Solved

I am having a problem trying to implement the JavaScriptSerializer to parse a JSON string received from a server. I implemented the following code: responseFromServer = readStream.ReadLine(); Ja...
Abaft asked 11/9, 2013 at 16:0

2

Solved

I am using JavaScriptSerializer to deserialize json data. Everything works pretty well, but my problem is, that one property in json data is named 'base', so I cannot create such property in my C#...
Gaffe asked 9/9, 2015 at 19:14

7

Solved

I'm using JavaScriptSerializer to serialize some entity objects. The problem is, many of the public properties contain null or default values. Is there any way to make JavaScriptSerializer exclude...
Feign asked 7/9, 2009 at 6:0

1

Solved

In my C# code, I'm trying to deserialize a JSON with 100s of properties (complex, primitive, derived) and I'm getting an error Cannot convert null to a value type. Though I finally knew which prop...
Straus asked 11/4, 2017 at 10:31

5

Solved

Apparently, IDictionary<string,object> is serialized as an array of KeyValuePair objects (e.g., [{Key:"foo", Value:"bar"}, ...]). Is is possible to serialize it as an object instead (e.g., {f...
Lita asked 20/6, 2011 at 20:17

4

Solved

Could you help me for resolving this issue. I have one asp.net application, in this i am using Javascript serializer for serializing a dataset followed by convertion to the list. That code is shown...
Rositaroskes asked 6/8, 2010 at 10:36

5

Solved

I've got a large amound of data I'm sending down to the client using jQuery's $.ajax() function. I'm calling a method in a ASP.NET web service that returns the JSON data. Everything is great for mo...
Oleoresin asked 25/6, 2009 at 20:13

7

Solved

I am pretty new at C# and .NET, but I've made this code to call a stored procedure, and I then want to take the returned DataTable and convert it to JSON. SqlConnection con = new SqlConnection("...
Charleen asked 22/2, 2010 at 18:5

3

Solved

I am using JavaScriptSerializer for serializing DateTime, but when I deserialize it show one day less from the date it get serialize: Here is test: DateTime startDate=new DateTime(2012,1,20);//...
Flotation asked 21/2, 2013 at 13:21

3

Solved

I know about ScriptIgnoreAttribute. But what if I want to ignore a property based on criteria. For example how to ignore a nullable property on serialization only if it's null and doesn't contai...
Selhorst asked 13/5, 2011 at 19:30

6

Solved

the json file's structure which I will deserialize looks like below; { "id" : "1lad07", "text" : "test", "url" : "http:\/\/twitpic.com\/1lacuz", "width" : 220, "height" : 84, "size" : 8722, ...
Perfusion asked 31/3, 2011 at 15:21

© 2022 - 2024 — McMap. All rights reserved.