public static List<Metadata> fromJson(Reader reader) throws IOException {
        List<Metadata> ms = null;
        if (reader == null) {
            return ms;
        }
        ms = new ArrayList<>();
        try (JsonParser jParser = new JsonFactory()
                .setStreamReadConstraints(StreamReadConstraints
                        .builder()
                        .maxStringLength(TikaConfig.getMaxJsonStringFieldLength())
                        .build())
                .createParser(CloseShieldReader.wrap(reader))) {

            JsonToken token = jParser.nextToken();
            if (token != JsonToken.START_ARRAY) {
                throw new IOException("metadata list must start with an array, but I see: " + token.name());
            }
            token = jParser.nextToken();
            while (token != JsonToken.END_ARRAY) {
                Metadata m = JsonMetadata.readMetadataObject(jParser);
                ms.add(m);
                token = jParser.nextToken();
            }

        }
        if (ms == null) {
            return null;
        }
        //if the last object is the main document,
        //as happens with the streaming serializer,
        //flip it to be the first element.
        if (ms.size() > 1) {
            Metadata last = ms.get(ms.size() - 1);
            String embResourcePath = last.get(TikaCoreProperties.EMBEDDED_RESOURCE_PATH);
            if (embResourcePath == null && ms
                    .get(0)
                    .get(TikaCoreProperties.EMBEDDED_RESOURCE_PATH) != null) {
                ms.add(0, ms.remove(ms.size() - 1));
            }
        }
        return ms;
    }
Read metadata from reader. This does not close the reader

@param reader
@return Metadata or null if nothing could be read from the reader
@throws IOException in case of parse failure or IO failure with Reader
tika-serialization/src/main/java/org/apache/tika/serialization/JsonMetadataList.java