Hi,

i've been looking around the web but could not find anything about the filestructure of the following file:

{"tickets":[{"name":"Test",
"id":"906935000",
"description":"gültig",
"userID":"310000",
"price":"Preis: 1,90€",
"productID":"119",
"checksum":"6017",
"dailyCode":"u",
"hourlyCode":"y",
"barcode":"",
"rebuyLink":"191000",
"buydate":"52744",
"buydateString":"17.08.2011",
"legalNote":".",
"validString":"gültig bis 17.08.2011",
"demo":true,
"validDescription":"gültig in 210"}],
"currentMonthExpenses":"1,90€",
"getMoreTicketsAvailable":false,
"monthlyTurnover":170};

This .dat-File is generated in javacode. (no source public)

I'm just lazy and dont want to write my own parser in java. ^^
There are methods like ObjectOutputStream and XMLEncoder/XMLDecoder but thats not XML and not binary as we can see.

Does anyone know what type of structure this is? Or better: does anyone know a parser for this code?

Parsing this is easy. Split each line at the first : and drop the " marks. That gives you a load of name/value pairs that you can do with as you wish. Unless you are really that lazy...

That looks like JSON output to me

I am really that lazy. :) Just kidding. The tricky part is the one between [{ and }]. That can be an array, so that there is a strutcure like [{..},{..}]. But i'm writing a parser directly into the class which holds the data from this structure. Thanks anyway. (God.. please make more people using xmlencoders...) :(

Thanks peter_budo! That's it! You saved me more time. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.