summaryrefslogtreecommitdiffstats
path: root/qjson.c
Commit message (Collapse)AuthorAgeFilesLines
* QJSON: Use OBJECT_CHECKEduardo Habkost2015-05-111-5/+5
| | | | | | | | | | The QJSON code used casts to (QJSON*) directly, instead of OBJECT_CHECK. There were even some functions using object_dynamic_cast() calls followed by assert(), which is exactly what OBJECT_CHECK does (by calling object_dynamic_cast_assert()). Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* QJSON: fix typo in author's email addressGreg Kurz2015-02-101-1/+1
| | | | | Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
* QJSON: Add JSON writerAlexander Graf2015-02-051-0/+129
| | | | | | | | | | | | | | | | To support programmatic JSON assembly while keeping the code that generates it readable, this patch introduces a simple JSON writer. It emits JSON serially into a buffer in memory. The nice thing about this writer is its simplicity and low memory overhead. Unlike the QMP JSON writer, this one does not need to spawn QObjects for every element it wants to represent. This is a prerequisite for the migration stream format description generator. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* build: move qobject files to qobject/ and libqemuutil.aPaolo Bonzini2013-01-121-294/+0Star
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* qapi: move include files to include/qobject/Paolo Bonzini2012-12-191-9/+9
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* Add support for JSON pretty printingDaniel P. Berrange2010-10-011-8/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The monitor does not pretty-print JSON output, so that everything will be on a single line reply. When JSON docs get large this is quite unpleasant to read. For the future command line capabilities query ability, huge JSON docs will be available. This needs the ability to pretty-print. This introduces a new API qobject_to_json_pretty() that does a minimal indentation of list and dict members. As an example, this makes {"QMP": {"version": {"micro": 50, "minor": 12, "package": "", "major": 0}, "capabilities": []}} Output as { "QMP": { "version": { "micro": 50, "minor": 12, "package": "", "major": 0 }, "capabilities": [ ] } } NB: this is not turned on for the QMP monitor. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* qjson: Handle "\f"Luiz Capitulino2010-06-111-0/+3
| | | | | | It's valid JSON and should be handled. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* qjson: Improve debuggingLuiz Capitulino2010-02-101-0/+5
| | | | | | | | Add an assert() to qobject_from_jsonf() to assure that the returned QObject is not NULL. Currently this is duplicated in the callers. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* json: escape u0000 .. u001F when outputting jsonAnthony Liguori2010-01-261-2/+8
| | | | | | | | | | | | | | | | | Markus Armbruster pointed out: JSON requires control characters in strings to be escaped. RFC 4627 section 2.5: A string begins and ends with quotation marks. All Unicode characters may be placed within the quotation marks except for the characters that must be escaped: quotation mark, reverse solidus, and the control characters (U+0000 through U+001F). We've been quoting the special escape sequences that JSON defines but we haven't been encoding the full control character range. This patch fixes that. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Introduce QErrorLuiz Capitulino2009-12-031-0/+2
| | | | | | | | | | | | | | | | QError is a high-level data type which represents an exception in QEMU, it stores the following error information: - class Error class name (eg. "ServiceUnavailable") - description A detailed error description, which can contain references to run-time error data - filename The file name of where the error occurred - line number The exact line number of the error - function The function name of where the error occurred - run-time data Any run-time error data Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* QJSON: Introduce qobject_from_jsonv()Luiz Capitulino2009-12-031-10/+11
| | | | | | | | | It accepts a va_list and will be used by QError. Also simplifies the code a little, as the other qobject_from_() functions can use it. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Provide marshalling mechanism for jsonAnthony Liguori2009-11-171-0/+178
| | | | | | | This introduces qobject_to_json which will convert a QObject to a JSON string representation. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Add a QObject JSON wrapperAnthony Liguori2009-11-171-0/+60
This provides a QObject interface for creating QObjects from a JSON expression. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>