Questions tagged [jsonserializer]

The JsonSerializer enables to control how objects are encoded into JSON. JSONSerializer will also pay attention to any method or field annotated by JSON.

JSONSerializer is the main class for performing serialization of Java objects to JSON. JSONSerializer by default performs a shallow serialization. While this might seem strange there is a method to this madness. Shallow serialization allows the developer to control what is serialized out of the object graph. This helps with performance, but more importantly makes good OO possible, fixes the circular reference problem, and doesn't require boiler plate translation code.

A simple example:

JSONSerializer serializer = new JSONSerializer();
return serializer.serialize( person );

Source:

Related tags:

512 questions
0
votes
1 answer

Creating an array of structures using libJson

I'm using libJson (C++ library) for parsing a JSON file. My JSON files looks as follows. { "Comany": { "name": "Some Company", "Resources": { "employees": [ {"name": "John", "id": "23432"}, …
Naresh
  • 633
  • 1
  • 6
  • 17
0
votes
1 answer

JSON from django rest Framework

I'm making a API with django rest framework, but the JSON has the the categoria's id of categoria model, the foreignkey, I want show the categoria's name equals the model's id class Establecimiento(models.Model): nombre=…
user3236034
  • 463
  • 3
  • 6
  • 14
0
votes
2 answers

Faster object json convertor

I have written a program which inserts in bulk to Elasticsearch in batch of around 3000. The problem is that I need to convert these object to json before executing the bulk insert request. But there is major downside with json convertion and it is…
0
votes
1 answer

Deserializing JSON string to C#

I have a JSON array, which looks like this: {[ { "personnelId": 201, "occupationIds": [ 4, 5 ] }, { "personnelId": 202, "occupationIds": [ 5 ] } ]} I'm receiving this string through a JObject in my…
Mohammad Sepahvand
  • 17,364
  • 22
  • 81
  • 122
0
votes
1 answer

Asp.Net Mvc Web Api Json Formatter issue

First ı want to tell u my architecture. My tale class for Tale table public class Tale { [ScaffoldColumnAttribute(false)] public int TaleId { get; set; } public string TaleName { get; set; } public string Content { get; set; } …
BerdaN
  • 49
  • 1
  • 9
0
votes
1 answer

JavaScriptSerializer Serializer is not handling null values

In my WPF MVVM application I am getting Data from a restful WCF service in JSON format. I am de-serializing this data using JavaScriptSerializer. But this is not able to handle the null value if any. In this case I have to send some values instead…
0
votes
1 answer

C# DataMember Serializer Ordering Opposite of Expected

According to this article, I'd expect to see the fields in my base class at the top of the list of fields when serializing to JSON. However, I'm seeing the fields at the bottom of the list. The ordering is correct within the actual class itself,…
0
votes
1 answer

couchdb date format automatically updated

Whenever I update any key in couchdb document, it updates existing all date keys in milliseconds formats. Example: created_at: 2013-07-09T09:25:00 to created_at: /Date(1373354700000)/ do you ever come across this issue?
rana
  • 145
  • 1
  • 2
  • 8
0
votes
2 answers

Difference between XML and Json serializer in MVC4

I found quite a nasty difference between the XML and Json serializer used by MVC4 today. I tried to return an object that looks like this: public class Person { public string FirstName {get;set;} public string LastName {get;set;} public string…
Øyvind Bråthen
  • 59,338
  • 27
  • 124
  • 151
0
votes
1 answer

Serialize JSON document using Jackson

I am trying to serialize JSON document using Jackson library. Below is my JSON document that I have created by hand. Now I need to serialize this document using Jackson Example-A { "v" : { "site_id" : 0, "price_score" : 0.5, …
user2467545
0
votes
1 answer

DataContractJsonSerializer returning nulls .Net4.0

This is the json string I need to…
0
votes
1 answer

Spring MVC REST JsonSerializer serialize long in exponential notation format

There is custom Json serializer(for ObjectMapper) in my Spring MVC REST application: public class DateSerializer extends JsonSerializer { public LocalDateSerializer() { super(); } @Override public void…
Mark Carmark
  • 167
  • 4
  • 11
0
votes
1 answer

how much camel caseing does CamelCasePropertyNamesContractResolver do?

using JSON.Net like this: JsonConvert.SerializeObject(someObject, Newtonsoft.Json.Formatting.None, new JsonSerializerSettings() { NullValueHandling =…
Homer
  • 7,594
  • 14
  • 69
  • 109
0
votes
1 answer

java-calling a method using Apache Http Client

I have a method in spring and I want to access the method using Apache HttpClient. following is my method : @PreAuthorize("isAuthenticated() and hasPermission(#request, 'CREATE_REQUISITION')") @RequestMapping(method = RequestMethod.POST, value…
Java Questions
  • 7,813
  • 41
  • 118
  • 176
0
votes
1 answer

calling a method through httpclient with json arguments is not working

i have a json string which is : `{ "portfolio": "HEXGENFUND", "transSrlNo": "1", "transCode": "BUY", "investReason": "004", "inflowOutflow": "I", "transDate": "2012-09-01", "tradeDate": "2012-09-01", "tradeDateUpto":…
Java Questions
  • 7,813
  • 41
  • 118
  • 176