Migrating BlinkList bookmarks and Powermarks bookmarks to del.icio.us

UPDATE: It seems that Blinklist’s JSON export doesn’t work any more, and delicious now requires OAuth authentication for new accounts (which rubilicious doesn’t support). So I created another script to transform Blinklist’s CSV format to HTML bookmark format which you can import to delicious. It’s done. I was suffering constant problems with BlinkList and I decided to move to del.icio.us. I also decided to rescue the old powermarks 3.5 bookmarks from the oblivion and import them to del.icio.us too. ...

July 11, 2008

Dojo, JSON, Xstream and FLEXJSON

I’ve been trying to use XStream to generate JSON to be consumed by Dojo. But I can’t find the way to generate the right JSON from XStream, it keeps adding extraneous {} around. I even tried this but no luck . For example I want to generate this JSON output (taken from Dojo FilteringSelect example) : {"identifier":"abbreviation", "items": [ {"name":"Alaska", "label":"Alaska","abbreviation":"AK"}, {"name":"Wyoming", "label":"Wyoming","abbreviation":"WY"} ]} My attempt usign XStream: package com.rubenlaguna.json; import java.util.ArrayList; import java.util.Collection; import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver; class ItemCollection { public String identifier; public Collection<Item> items = new ArrayList<Item>(); public ItemCollection(String identifier) { this.identifier = identifier; } public boolean add(Item arg0) { return items.add(arg0); } } class Item { public String name; public String label; public String abbreviation; public Item(String name, String label, String abbreviation) { this.name = name; this.label = label; this.abbreviation = abbreviation; } } public class WriteXStreamDojoTest { public static void main(String[] args) { ItemCollection itemCollection = new ItemCollection("abbreviation"); itemCollection.add(new Item("Alaska","Alaska","AK")); itemCollection.add(new Item("Wyoming","Wyoming","WY")); XStream xstream = new XStream(new JettisonMappedXmlDriver()); String erroneousJsonStr = xstream.toXML(itemCollection); System.out.println(erroneousJsonStr); } } resulted in the following JSON Output (i added some space and breaklines for readability): ...

October 9, 2007