private E writeObject(String jsonObject) throws IOException {
        // todo check why android app requires this
        // jsonObject = jsonObject.trim();
        // sanity: string starts and ends with {}
        if (!jsonObject.startsWith("{") || !jsonObject.endsWith("}")) {
            throw new IOException("String is not bracketed by {}!");
        }
        // get values
        HashMap<String, String> simplePairs = jsonValues(jsonObject);
        // check that we have our class type information
        String typeValue = simplePairs.get(TYPE_KEY);
        if (typeValue == null) {
            throw new IOException("Required field " + TYPE_KEY + " not found!");
        }
        // check that registered
        Class objectClass = typesStringClass.get(typeValue);
        if (objectClass == null) {
            throw new IOException(TAG + ": Unregistered type found!");
        }
        // remove TYPE_KEY
        simplePairs.remove(TYPE_KEY);
        // create java object
        E object;
        try {
            Constructor constructor = objectClass.getDeclaredConstructor(new Class[]{});
            constructor.setAccessible(true);
            object = (E) constructor.newInstance(new Class[]{});
        } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
            log.error(TAG, "Default constructor missing for " + objectClass.toString() + "!");
            throw new IOException(TAG + ": Objects must have default constructor! May be private though.");
        }
        // apply all fields, leaving those we have no value for at their default value
        for (Map.Entry<String, String> entry : simplePairs.entrySet()) {
            Field f = null;
            try {
                f = objectClass.getDeclaredField(entry.getKey());
            } catch (NoSuchFieldException e) {
                // Silently ignore but warn
                log.error(TAG, "Field " + entry.getKey() + " does not exist for object " + typeValue + "!");
                continue;
            }
            f.setAccessible(true);
            Object parsedValue = typeCastParse(f.getType(), entry.getValue());
            try {
                // this is where we also parse the value to the correct type
                f.set(object, parsedValue);
            } catch (IllegalAccessException e) {
                throw new IOException(TAG + ": Failed to write fields!");
            }
        }
        return object;
    }