Commit Graph

540 Commits

Author SHA1 Message Date
Petri Lehtinen
ec96cbf016 Encode reals correctly
This patch changes the sprintf format from "%0.17f" to "%.17g", as the
f format specifier doesn't print the exponent at all. This caused
losing precision in all but the most simple cases.

Because the g specifier doesn't print the decimal fraction or exponent
if they're not needed, a ".0" has to be appended by hand in these
cases. Otherwise the value's type changes from real to integer when
decoding again.

Thanks to Philip Grandinetti for reporting this issue.
2009-12-18 00:05:06 +02:00
Petri Lehtinen
19a606d736 Implement JSON_SORT_KEYS encoding flag
With this flag, the objects are sorted by key when encoding.
2009-12-16 23:12:39 +02:00
Petri Lehtinen
3add1cf361 Refactor the test system 2009-12-16 22:45:29 +02:00
Petri Lehtinen
50031440a3 Implement JSON_ENSURE_ASCII encoding flag
With this flag, all Unicode characters outside the ASCII range are
escaped.
2009-12-05 22:55:30 +02:00
Petri Lehtinen
d67aeb9739 Use int32_t instead of plain int with Unicode code points
On some architectures, int just isn't big enough to hold all Unicode
code points.
2009-12-02 23:53:54 +02:00
Petri Lehtinen
7c707a73a2 Only export symbols starting with "json_" in libjansson.la
This way we don't pollute the symbol namespace with internal symbols.
2009-11-29 13:04:12 +02:00
Petri Lehtinen
330e892ff6 Make parse_json static 2009-11-29 13:00:47 +02:00
Petri Lehtinen
d857fd08a5 doc/github_commits.c Add copyright notice 2009-11-28 13:39:06 +02:00
Petri Lehtinen
e0a88d19d1 Merge branch '1.1'
Conflicts:
	configure.ac
	doc/conf.py
2009-11-08 22:01:02 +02:00
Petri Lehtinen
842bc2128b jansson 1.1.2 2009-11-08 14:13:32 +02:00
Petri Lehtinen
ca6d26a1c2 Don't include stdint.h in jansson.h
It's not needed
2009-11-07 14:45:46 +02:00
Petri Lehtinen
17d913307e Merge branch '1.1'
Conflicts:
	test/.gitignore
	test/testprogs/Makefile.am
2009-11-04 22:10:46 +02:00
Petri Lehtinen
f236c14dc5 dump: Revise whitespace usage
- Never append newline to output
- By default, add spaces between array and object items for more
  readable output
- Introduce the flag JSON_COMPACT to not add the aforementioned spaces
2009-11-04 22:09:40 +02:00
Petri Lehtinen
bf01067a8a Build documentation in make html target
To keep the distchecks for the documentation, the documentation has to
be built in the check target instead of distcheck-hook.

While at it, rename doc/.build to doc/_build. This naming is the
default with sphinx 0.6.2.
2009-11-03 23:09:04 +02:00
Petri Lehtinen
d3959a8ce7 load: Parse a badly put - sign correctly
Thanks to Manolis Delakis for reporting.
2009-10-29 15:45:16 +02:00
Petri Lehtinen
f243930b68 json_load_file: Initialize the error struct properly
Failing to do this has the effect that the error message is not
returned when the input file cannot be opened (e.g. if it doesn't
exist).

Thanks to Martin Vopatek for reporting.
2009-10-27 17:56:02 +02:00
Petri Lehtinen
d1b07171cc Merge branch '1.1'
Conflicts:
	CHANGES
	configure.ac
	doc/conf.py
2009-10-26 21:33:03 +02:00
Petri Lehtinen
15d992cb6a jansson 1.1.1 2009-10-26 21:27:10 +02:00
Petri Lehtinen
59c58ea26c Build documentation in distcheck-hook
This is to check that all the documentation files are distributed
before releasing.
2009-10-25 00:20:23 +03:00
Petri Lehtinen
f95bb423a3 Really distribute all the docs
The tutorial example github_commits.c was still left out.
2009-10-25 00:17:16 +03:00
Petri Lehtinen
9448ed3ef7 Distribute all the docs 2009-10-24 14:16:12 +03:00
Petri Lehtinen
7c7a1ed01e Fix version 1.1 release date in CHANGES 2009-10-24 14:16:11 +03:00
Petri Lehtinen
5ff8ae8052 Fix version 1.1 release date in CHANGES 2009-10-21 08:52:34 +03:00
Petri Lehtinen
8d53f447bf Set the version number to 1.1+ 2009-10-21 08:51:43 +03:00
Petri Lehtinen
325101e525 jansson 1.1 2009-10-20 21:29:16 +03:00
Petri Lehtinen
1b02f3546c Distribute stripped unit test data
Apparently, it was forgotten to add these files to
test/testdata/Makefile.am in commit
04d550b02e.
2009-10-20 21:23:49 +03:00
Petri Lehtinen
cd96049d10 Enhance documentation
- Add more information to the documentation front page
- Document how to build the documentation
- Clarify the tutorial a bit and remove some quirks
- Bring README.rst up-to-date
- Small enhancements here and there
2009-10-19 21:56:11 +03:00
raoulh
a83cd30c31 Add C++ guards to jansson.h
Signed-off-by: Petri Lehtinen <petri@digip.org>
2009-10-19 12:22:21 +03:00
Petri Lehtinen
a00988f663 doc: Add tutorial 2009-10-17 14:18:40 +03:00
Petri Lehtinen
86dc1d629b Fix indentation
No functional changes.
2009-10-16 21:20:38 +03:00
Petri Lehtinen
b67e130fda json_dumpf: Document the output shortage on error 2009-10-15 21:06:59 +03:00
Petri Lehtinen
4cd777712b Enhance handling of circular references
It's now an error to try to add an object or array to itself. The
encoder checks for circular references and fails with an error status
if one is detected.
2009-10-15 21:02:27 +03:00
Petri Lehtinen
79009e62c1 json_dumps: Close the strbuffer if dumping fails 2009-10-15 20:54:32 +03:00
Petri Lehtinen
76999799ed doc: Fix a small typo in apiref 2009-10-15 17:39:49 +03:00
Petri Lehtinen
22af193a51 doc/Makefile.am: Remove *.pyc in clean 2009-10-14 22:09:14 +03:00
Petri Lehtinen
951d091f07 Make integer, real and string mutable
Added functions:

  json_string_set
  json_integer_set
  json_real_set

While at it, clarify the documentation and parameter naming of
json_{string,integer,real}_value() a bit.
2009-10-14 08:23:02 +03:00
Petri Lehtinen
185e107d24 Don't use non-portable asprintf()
Thanks to Adam Strzelecki for reporting.
2009-10-13 15:40:26 +03:00
Petri Lehtinen
ca7703fbd1 Merge branch '1.0'
Conflicts:
	configure.ac
	doc/conf.py
2009-10-11 21:51:54 +03:00
Petri Lehtinen
12cd4e8c09 jansson 1.0.4 2009-10-11 21:38:42 +03:00
Petri Lehtinen
bad16ea52a Fix API tests for object
Because of a typo in test/testprogs/Makefile.am, the tests for object
were never compiled or run.
2009-10-11 21:38:42 +03:00
Petri Lehtinen
30015bde90 Remove config.h.in
It doesn't have to be in version control.
2009-10-11 21:38:41 +03:00
Petri Lehtinen
1e00cd58a5 Extend object API
Added functions:

  json_object_size
  json_object_clear
  json_object_update
2009-10-11 20:44:01 +03:00
Petri Lehtinen
40bb7bf437 Fix API tests for object
Because of a typo in test/testprogs/Makefile.am, the tests for object
were never compiled or run.
2009-10-10 22:55:15 +03:00
Petri Lehtinen
9d648a87cb Check json_object_set_new arguments
A segfault was caused by NULL key.
2009-10-10 22:53:36 +03:00
Petri Lehtinen
8de850be95 Remove config.h.in
It doesn't have to be in version control.
2009-10-10 21:21:22 +03:00
Petri Lehtinen
19588c2d69 Fix a few more compilation issues
These were left out from the previous commit.
2009-10-06 13:22:27 +03:00
Petri Lehtinen
9c5a8430db Make it compile on platforms where char is unsigned
Linux on powerpc seems to be one such platform.
2009-10-01 21:54:45 +03:00
Petri Lehtinen
afc9c1a23a Relax Autoconf version prereq
From 2.63 to 2.59, which is more widely supported.
2009-10-01 21:54:29 +03:00
Petri Lehtinen
cbacac5975 Extend array API
Added functions:

  json_array_insert
  json_array_insert_new
  json_array_remove
  json_array_clear
  json_array_extend
2009-09-29 22:17:58 +03:00
Petri Lehtinen
b3e1fe2ec5 doc: Add getting started guide 2009-09-20 21:56:12 +03:00