// Path: json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/Utils.java
// static void closeQuietly(final Reader resourceReader) {
//     if (resourceReader != null) {
//         try {
//             resourceReader.close();
//         } catch (IOException ignored) {
//         }
//     }
// }
// 
// Path: json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/Utils.java
// static Reader toReader(String string) {
//     return new JsonStringReader(string);
// }


import com.squareup.moshi.JsonAdapter;
import com.squareup.moshi.Moshi;
import java.io.IOException;
import java.io.Reader;
import java.math.BigDecimal;
import java.math.RoundingMode;
import static net.javacrumbs.jsonunit.core.internal.Utils.closeQuietly;
import static net.javacrumbs.jsonunit.core.internal.Utils.toReader;
    @Override
    protected Node doConvertValue(Object source) {
        return newNode(source);
    }

    @Override
    protected Node nullNode() {
        return newNode(null);
    }

    @Override
    protected Node readValue(String source, String label, boolean lenient) {
        try {
            JsonAdapter<Object> adapter = moshi.adapter(Object.class);
            if (lenient) {
                adapter = adapter.lenient();
            }
            return newNode(adapter.fromJson(source));
        } catch (IOException e) {
            throw newParseException(label, toReader(source), e);
        }
    }

    @Override
    protected Node readValue(Reader value, String label, boolean lenient) {
        try {
            return readValue(Utils.readAsString(value), label, lenient);
        } catch (IOException e) {
            throw new IllegalArgumentException("Can not parse " + label + " value.", e);
        } finally {
// Path: json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/Utils.java
// static void closeQuietly(final Reader resourceReader) {
//     if (resourceReader != null) {
//         try {
//             resourceReader.close();
//         } catch (IOException ignored) {
//         }
//     }
// }
// 
// Path: json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/Utils.java
// static Reader toReader(String string) {
//     return new JsonStringReader(string);
// }


// Path: json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/MoshiNodeFactory.java
import com.squareup.moshi.JsonAdapter;
import com.squareup.moshi.Moshi;
import java.io.IOException;
import java.io.Reader;
import java.math.BigDecimal;
import java.math.RoundingMode;
import static net.javacrumbs.jsonunit.core.internal.Utils.closeQuietly;
import static net.javacrumbs.jsonunit.core.internal.Utils.toReader;

    @Override
    protected Node doConvertValue(Object source) {
        return newNode(source);
    }

    @Override
    protected Node nullNode() {
        return newNode(null);
    }

    @Override
    protected Node readValue(String source, String label, boolean lenient) {
        try {
            JsonAdapter<Object> adapter = moshi.adapter(Object.class);
            if (lenient) {
                adapter = adapter.lenient();
            }
            return newNode(adapter.fromJson(source));
        } catch (IOException e) {
            throw newParseException(label, toReader(source), e);
        }
    }

    @Override
    protected Node readValue(Reader value, String label, boolean lenient) {
        try {
            return readValue(Utils.readAsString(value), label, lenient);
        } catch (IOException e) {
            throw new IllegalArgumentException("Can not parse " + label + " value.", e);
        } finally {
            closeQuietly(value);