How to use @JsonIdentityInfo with circular references?

I am trying to use the @JsonIdentityInfo from Jackson 2 as described here. For testing purposes I created the following two classes: public class A { private B b; // constructor(s) and getter/setter omitted } public class B { private A a; // see above } Of course, the naive approach failes: @Test public void … Read more

Parse JSON response with Swift 3

I have JSON looking like this: {“posts”: [ { “id”:”1″,”title”:”title 1″ }, { “id”:”2″,”title”:”title 2″ }, { “id”:”3″,”title”:”title 3″ }, { “id”:”4″,”title”:”title 4″ }, { “id”:”5″,”title”:”title 5″ } ], “text”:”Some text”, “result”:1 } How can I parse that JSON with Swift 3? I have this: let url = URL(string: “”)! let request = URLRequest(url: url) … Read more

ReferenceError: “Sheets” is not defined

This is my first attempt with script editor. I was assigned to do a script to crate pivot table for google sheet. //creating pivot table through script editor for google sheet function addPivotTable() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheetName = “Sheet1”; // Create a new sheet which will contain our Pivot Table var pivotTableSheet … Read more

spring mvc rest response json and xml

I have the requirement to return the result from the database either as a string in xml-structure or as json-structure. I’ve got a solution, but I don’t know, if this one is the best way to solve this. I have two methods here: @RequestMapping(value = “/content/json/{ids}”, method = RequestMethod.GET) public ResponseEntity<String> getContentByIdsAsJSON(@PathVariable(“ids”) String ids) { … Read more

Spring-MVC 406 Not Acceptable instead of JSON Response

I’m trying to return a JSON response with Spring 3.0.6, but I get a 406 response “Not Acceptable”, with the description: “The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request “accept” headers ().” I know that a very similar question has been asked before, … Read more

Is it possible to query for datetime ranges with the Stripe API?

Using the Stripe API, I’d like to be able to query for date ranges or, failing that, dates that are greater than or less than some arbitrary date. I know that I can query for something based on an exact date, e.g.,: But I want something along the lines of… # Search for events … Read more

Fastest way to import millions of JSON documents to MongoDB

I have more than 10 million JSON documents of the form : [“key”: “val2”, “key1” : “val”, “{\”key\”:\”val”, \”key2\”:\”val2″}”] in one file. Importing using JAVA Driver API took around 3 hours, while using the following function (importing one BSON at a time): public static void importJSONFileToDBUsingJavaDriver(String pathToFile, DB db, String collectionName) { // open file … Read more

How can I put a Postgres JSON value into a Rails fixture?

I just added a Postgres json type to a Rails/Active Record table I’m working with. I’d like to populate a record with a default value in Rails fixtures: fixture_id: existing_column: “foobar” newly_added_column: <%= JSON.dump({:reason => ‘foobar’}) %> Previously, I’d stored stringified JSON this way in a text column. However, when I now run this unit … Read more