diff options
author | Kai Koehne <kai.koehne@qt.io> | 2016-05-30 16:57:00 +0200 |
---|---|---|
committer | Kai Koehne <kai.koehne@qt.io> | 2016-07-01 14:55:29 +0000 |
commit | 9964b850ad9c322ab842bbd5941976b3d613f5f6 (patch) | |
tree | f4d27056697e6dad6ec35c53e7f9a7ce3d7355d3 /src/corelib/json | |
parent | c3f645a24ac743e66f4345058983ad877f723a14 (diff) |
Doc: Improve QJsonDocument::fromJson documentation
Be explicit on how to check whether parsing succeeds.
Change-Id: I44f408cb6e5a830826b84dfb3a8af331f03e58cc
Reviewed-by: Topi Reiniƶ <topi.reinio@theqtcompany.com>
Diffstat (limited to 'src/corelib/json')
-rw-r--r-- | src/corelib/json/qjsondocument.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/corelib/json/qjsondocument.cpp b/src/corelib/json/qjsondocument.cpp index 5f8f807cf0..7af7e4080c 100644 --- a/src/corelib/json/qjsondocument.cpp +++ b/src/corelib/json/qjsondocument.cpp @@ -351,16 +351,14 @@ QByteArray QJsonDocument::toJson(JsonFormat format) const #endif /*! - Parses a UTF-8 encoded JSON document and creates a QJsonDocument + Parses \a json as a UTF-8 encoded JSON document, and creates a QJsonDocument from it. - \a json contains the json document to be parsed. + Returns a valid (non-null) QJsonDocument if the parsing succeeds. If it fails, + the returned document will be null, and the optional \a error variable will contain + further details about the error. - The optional \a error variable can be used to pass in a QJsonParseError data - structure that will contain information about possible errors encountered during - parsing. - - \sa toJson(), QJsonParseError + \sa toJson(), QJsonParseError, isNull() */ QJsonDocument QJsonDocument::fromJson(const QByteArray &json, QJsonParseError *error) { |