JSON conversion work

so it is all written and should be correct. This is more Java code than
android which makes it slightly easier!