Compares two JSON strings and returns whether they represent the same document (thus ignoring things like object ordering or multiple representations of the same number).

Synopsis

Declared in <folly/json/JsonTestUtil.h>

bool
compareJson(
    StringPiece json1,
    StringPiece json2);

Description

This is implemented by deserializing both strings into dynamic, so it is not efficient and it is meant to only be used in tests.

It will throw an exception if any of the inputs is invalid.

Return Value

True if both strings represent the same document.

Parameters

Name

Description

json1

The first JSON string.

json2

The second JSON string.

Created with MrDocs