{@inheritDoc}

Deserializes all the properties of the bean. The {@link JsonReader} must be in a json object.
326042
@Override
    public final T deserializeInline( final JsonReader reader, final JsonDeserializationContext ctx, JsonDeserializerParameters params,
                                      IdentityDeserializationInfo identityInfo, TypeDeserializationInfo typeInfo, String type,
                                      Map<String, String> bufferedProperties ) {
        final boolean ignoreUnknown = params.isIgnoreUnknown() || isDefaultIgnoreUnknown();
        final Set<String> ignoredProperties;
        if ( null == params.getIgnoredProperties() ) {
            ignoredProperties = defaultIgnoredProperties;
        } else {
            ignoredProperties = new HashSet<String>( defaultIgnoredProperties );
            ignoredProperties.addAll( params.getIgnoredProperties() );
        }

        // we will remove the properties read from this list and check at the end it's empty
        Set<String> requiredPropertiesLeft = requiredProperties.isEmpty() ? Collections
                .<String>emptySet() : new HashSet<String>( requiredProperties );

        // we first look for identity. It can also buffer properties if it is not in current reader position.
        Object id = null;
        Map<String, Object> bufferedPropertiesValues = null;
        if ( null != identityInfo ) {
            JsonReader identityReader = null;

            // we look if it has not been already buffered
            String propertyValue = null;

            // we fisrt look if the identity property has not been read already
            if ( null != bufferedProperties ) {
                propertyValue = bufferedProperties.remove( identityInfo.getPropertyName() );
            }

            if ( null != propertyValue ) {
                identityReader = ctx.newJsonReader( propertyValue );
            } else {
                // we search for the identity property
                while ( JsonToken.NAME.equals( reader.peek() ) ) {
                    String name = reader.nextName();

                    if ( ignoredProperties.contains( name ) ) {
                        reader.skipValue();
                        continue;
                    }

                    if ( identityInfo.getPropertyName().equals( name ) ) {
                        identityReader = reader;
                        break;
                    } else {
                        if ( null == bufferedProperties ) {
                            bufferedProperties = new HashMap<String, String>();
                        }
                        bufferedProperties.put( name, reader.nextValue() );
                    }
                }
            }

            if ( null != identityReader ) {
                if ( identityInfo.isProperty() ) {
                    HasDeserializerAndParameters propertyDeserializer = deserializers.get( identityInfo.getPropertyName() );
                    if ( null == propertyDeserializer ) {
                        // the identity property is defined in constructor
                        propertyDeserializer = instanceBuilder.getParametersDeserializer().get( identityInfo.getPropertyName() );
                        id = propertyDeserializer.getDeserializer().deserialize( identityReader, ctx );
                        bufferedPropertiesValues = new HashMap<String, Object>( 1 );
                        bufferedPropertiesValues.put( identityInfo.getPropertyName(), id );
                    } else {
                        id = propertyDeserializer.getDeserializer().deserialize( identityReader, ctx );
                    }
                } else {
                    id = identityInfo.readId( identityReader, ctx );
                }
            }
        }

        // we first instantiate the bean. It might buffer properties if there are properties required for constructor and they are not in
        // first position
        Instance<T> instance = instanceBuilder.newInstance( reader, ctx, params, bufferedProperties, bufferedPropertiesValues );

        T bean = instance.getInstance();
        bufferedProperties = instance.getBufferedProperties();

        // we save the instance if we have an id
        if ( null != id ) {
            if ( identityInfo.isProperty() ) {
                BeanPropertyDeserializer propertyDeserializer = deserializers.get( identityInfo.getPropertyName() );
                if ( null != propertyDeserializer ) {
                    propertyDeserializer.setValue( bean, id, ctx );
                }
            }
            ctx.addObjectId( identityInfo.newIdKey( id ), bean );
        }

        // we flush any buffered properties
        flushBufferedProperties( bean, bufferedProperties, requiredPropertiesLeft, ctx, ignoreUnknown, ignoredProperties );

        // in case there is a property that need the type info
        if ( null != typeInfo && null != typeInfo.getPropertyName() && null != type ) {
            BeanPropertyDeserializer deserializer = getPropertyDeserializer( typeInfo.getPropertyName(), ctx, true );
            if ( null != deserializer ) {
                deserializer.setValue( bean, type, ctx );
            }
        }

        while ( JsonToken.NAME.equals( reader.peek() ) ) {
            String propertyName = reader.nextName();

            requiredPropertiesLeft.remove( propertyName );

            if ( ignoredProperties.contains( propertyName ) ) {
                reader.skipValue();
                continue;
            }

            BeanPropertyDeserializer<T, ?> property = getPropertyDeserializer( propertyName, ctx, ignoreUnknown );
            if ( null != property ) {
                property.deserialize( reader, bean, ctx );
            } else if ( null != anySetterDeserializer ) {
                anySetterDeserializer.deserialize( reader, bean, propertyName, ctx );
            } else {
                reader.skipValue();
            }
        }

        if ( !requiredPropertiesLeft.isEmpty() ) {
            throw ctx.traceError( "Required properties are missing : " + requiredPropertiesLeft, reader );
        }
        return bean;
    }
1225251
@SuppressWarnings({"unchecked"})
    public <T> T read(String json) {
        return read(json, Configuration.defaultConfiguration());
    }
337810
public static JSONObject toJSONObject(java.util.Properties properties) throws JSONException {
        // can't use the new constructor for Android support
        // JSONObject jo = new JSONObject(properties == null ? 0 : properties.size());
        JSONObject jo = new JSONObject();
        if (properties != null && !properties.isEmpty()) {
            Enumeration<?> enumProperties = properties.propertyNames();
            while(enumProperties.hasMoreElements()) {
                String name = (String)enumProperties.nextElement();
                jo.put(name, properties.getProperty(name));
            }
        }
        return jo;
    }
535176
private Object deserialize(InputStream byteStream) throws IOException, ClassNotFoundException {
        ObjectInputStream in = new ObjectInputStream(byteStream);
        try {
            return in.readObject();
        } finally {
            in.close();
        }
    }
670914
protected JsonDeserializer<Object> _findRootDeserializer(DeserializationConfig cfg, JavaType valueType)
            throws JsonMappingException {

        // Sanity check: must have actual type...
        if (valueType == null) {
            throw new JsonMappingException("No value type configured for ObjectReader");
        }

        // First: have we already seen it?
        JsonDeserializer<Object> deser = _rootDeserializers.get(valueType);
        if (deser != null) {
            return deser;
        }

        // es-hadoop: findType with 2 args have been removed since 1.9 so this code compiles on 1.8 (which has the fallback method)
        // es-hadoop: on 1.5 only the 2 args method exists, since 1.9 only the one with 3 args hence the if

        // Nope: need to ask provider to resolve it
        deser = _provider.findTypedValueDeserializer(cfg, valueType);
        if (deser == null) { // can this happen?
            throw new JsonMappingException("Can not find a deserializer for type " + valueType);
        }
        _rootDeserializers.put(valueType, deser);
        return deser;
    }
615498
@Override
    public Element[] deserialize(final JsonElement json, final Type typeOfT,
                                 final JsonDeserializationContext context) {

        final Element[] elements;

        if (json.isJsonObject()) {
            elements = new Element[json.getAsJsonObject().entrySet().size()];
            int i = 0;
            for (final Entry<String, JsonElement> elem : json.getAsJsonObject().entrySet()) {
                elements[i] = new Element();
                elements[i].setKey(elem.getKey());
                elements[i].setValue(elem.getValue().getAsString());
                i++;
            }
        } else {
            throw new JsonParseException("Unexpected data: " + json.toString());
        }
        return elements;
    }
1321039
@SuppressWarnings("unchecked")
    public static <T extends BaseBo> T fromJson(String json, Class<T> clazz,
            ClassLoader classLoader) {
        if (StringUtils.isBlank(json) || clazz == null) {
            return null;
        }
        try {
            Map<String, Object> data = SerializationUtils.fromJsonString(json, Map.class);
            String boClassName = DPathUtils.getValue(data, FIELD_CLASSNAME, String.class);
            T bo = createObject(boClassName, classLoader, clazz);
            if (bo != null) {
                bo.fromJson(DPathUtils.getValue(data, FIELD_BODATA, String.class));
                return bo;
            } else {
                return null;
            }
        } catch (Exception e) {
            throw e instanceof DeserializationException ? (DeserializationException) e
                    : new DeserializationException(e);
        }
    }
922651
public <T> T read(final InputStream stream, final DataTypeDescriptor<T> descriptor)
			throws Exception {
		if (stream == null) throw new NullPointerException("input");
		if (descriptor == null) throw new NullPointerException("descriptor");

		JsonParser parser = factory.createParser(stream);
		return read(parser, descriptor);
	}
1372311
private Object parseBean(JsonEvent event, Class<?> beanType) throws Exception {
        String propName = "";
        try {
            SerDeserializer deser = settings.getDeserializers().findDeserializer(beanType);
            MetaBean metaBean = deser.findMetaBean(beanType);
            BeanBuilder<?> builder = deser.createBuilder(beanType, metaBean);
            while (event != JsonEvent.OBJECT_END) {
                // property name
                propName = input.acceptObjectKey(event);
                MetaProperty<?> metaProp = deser.findMetaProperty(beanType, metaBean, propName);
                // ignore unknown properties
                if (metaProp == null || metaProp.style().isDerived()) {
                    input.skipData();
                } else {
                    Object value = parseObject(input.readEvent(),
                            SerOptional.extractType(metaProp, beanType), metaProp, beanType, null, false);
                    deser.setValue(builder, metaProp, SerOptional.wrapValue(metaProp, beanType, value));
                }
                propName = "";
                event = input.acceptObjectSeparator();
            }
            return deser.build(beanType, builder);
        } catch (Exception ex) {
            throw new IllegalArgumentException(
                    "Error parsing bean: " + beanType.getName() + "::" + propName + ", " + ex.getMessage(), ex);
        }
    }
370376
public <T> T parse(InputStream in, JsonReaderI<T> mapper) throws ParseException, UnsupportedEncodingException {
		InputStreamReader i2 = new InputStreamReader(in, "utf8");
		//
		return super.parse(i2, mapper);
	}
252538
public void parseJSON(Reader reader) {
        Listener sajListener = new Listener();
        new JSONAnnie(reader).parse(sajListener);
    }
1050145
public Object parse(Reader reader) {
        if (reader == null) {
            throw new IllegalArgumentException("Reader must not be null");
        }

        Object content;
        JsonParser parser = createParser();
        content = parser.parse(reader);
        return content;
    }
673728
public V deserialize( JsonReader reader, JsonDeserializationContext ctx ) {
        return getDeserializer().deserialize( reader, ctx, getParameters() );
    }
964683
public List<String> getProperties(String json) {
        List<String> properties = new ArrayList<>();
        JsonObject jsonObject = new JsonParser().parse(json).getAsJsonObject();
        for (Map.Entry<String, JsonElement> property : jsonObject.entrySet()) {
            properties.add(property.getKey());
        }
        return properties;
    }
757003
JSONObject beanSerialize(final Object resource,
                             final Map<String, Object> out) {
        final Class clazz = resource.getClass();
        final Method[] methods = clazz.getDeclaredMethods();
        final JSONObject json = new JSONObject();

        if (clazz.equals(Import.class)) {
            return ((Import) resource).serialize(out);
        } else if (clazz.equals(ImportBatch.class)) {
            return ((ImportBatch) resource).toJson();
        }

        for (final Method m : methods) {

            try {
                if (Modifier.isPublic(m.getModifiers())) {
                    final String name = m.getName();
                    if (name.equals("getClass") || name.equals("getDeclaringClass")) {
                        continue;
                    }

                    final JsonProperty jsonProp = m.getAnnotation(JsonProperty.class);
                    if (m.getAnnotation(JsonIgnore.class) != null) {
                        continue;
                    }

                    boolean isGetter = name.length() > 3 && name.startsWith("get")
                                       && Character.isUpperCase(name.charAt(3));
                    boolean isBoolGetter = name.length() > 2 && name.startsWith("is")
                                           && Character.isUpperCase(name.charAt(2));

                    final String key;
                    if (jsonProp != null) {
                        key = jsonProp.value();
                    } else if (isGetter) {
                        key = Character.toLowerCase(name.charAt(3)) + name.substring(4);
                    } else if (isBoolGetter) {
                        key = Character.toLowerCase(name.charAt(2)) + name.substring(3);
                    } else {
                        continue;  // on to the next method
                    }

                    if (key != null) {
                        final Object object = m.invoke(resource, (Object[]) null);
                        Object result;

                        if (object != null) {
                            try {
                                if (object instanceof JSONObject
                                    || object instanceof JSONArray
                                    || object instanceof Byte
                                    || object instanceof Character
                                    || object instanceof Short
                                    || object instanceof Integer
                                    || object instanceof Long
                                    || object instanceof Boolean
                                    || object instanceof Float
                                    || object instanceof Double
                                    || object instanceof String) {
                                    result = object;
                                } else if (object instanceof Collection) {
                                    result = new JSONArray((Collection) object);
                                } else if (object.getClass().isArray()) {
                                    result = new JSONArray(Arrays.asList(object));
                                } else if (object instanceof Map) {
                                    result = new JSONObject((Map) object);
                                } else if (object instanceof Date) {
                                    result = Util.DATE_FORMAT.format((Date) object);
                                } else {
                                    Package objectPackage = object.getClass().getPackage();
                                    String objectPackageName =
                                        objectPackage != null ? objectPackage.getName() : "";
                                    if (objectPackageName.startsWith("java.")
                                        || objectPackageName.startsWith("javax.")
                                        || object.getClass().getClassLoader() == null) {
                                        result = object.toString();
                                    } else {
                                        result = beanSerialize(object, out);
                                    }
                                }
                                if (result != null) {
                                    out.put(key, result);
                                    json.put(key, result);
                                }
                            } catch (Exception exception) {
                                return null;
                            }
                        }
                    }
                }
            } catch (Exception ignore) {
            }
        }
        return json;
    }
268910
@Override
    public synchronized ContentProperties read()
        throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException {

        if (jParser == null) {
            JsonFactory jfactory = new JsonFactory();
            jParser = jfactory.createJsonParser(this.propertiesFile);
            jParser.nextToken(); //skips the first [

            //skip properties already read.
            int itemsRead = (int) getItemsRead();
            for (int i = 0; i < itemsRead; i++) {
                doRead();
            }
        }

        return doRead();
    }
723602
public static void json(Object obj, final String[] properties,
                            Writer writer, boolean writeClass,
                            Converter<Object, Map<String, Object>> mc) throws IOException {
        if (obj == null)
            writer.write(NULL);
        else
            json(obj, properties, new JSONWriter(writer), writeClass, mc);
    }