@@ -949,6 +949,22 @@ Read and write ``JSON`` format files.
949
949
950
950
Writing JSON
951
951
~~~~~~~~~~~~
952
+
953
+ A ``Series `` or ``DataFrame `` can be converted to a valid JSON string. Use ``to_json ``
954
+ with optional parameters:
955
+
956
+ - orient : The format of the JSON string, default is ``index `` for ``Series ``, ``columns `` for ``DataFrame ``
957
+
958
+ * split : dict like {index -> [index], columns -> [columns], data -> [values]}
959
+ * records : list like [{column -> value}, ... , {column -> value}]
960
+ * index : dict like {index -> {column -> value}}
961
+ * columns : dict like {column -> {index -> value}}
962
+ * values : just the values array
963
+
964
+ - double_precision : The number of decimal places to use when encoding floating point values, default 10.
965
+ - force_ascii : force encoded string to be ASCII, default True.
966
+
967
+ Note NaN's and None will be converted to null and datetime objects will be converted to UNIX timestamps.
952
968
953
969
.. ipython :: python
954
970
@@ -959,6 +975,24 @@ Writing JSON
959
975
Reading JSON
960
976
~~~~~~~~~~~~
961
977
978
+ Reading a JSON string to pandas object can take a number of parameters.
979
+ The parser will try to parse a ``DataFrame `` if ``typ `` is not supplied or
980
+ is ``None ``. To explicity force ``Series `` parsing, pass ``typ=series ``
981
+
982
+ - json : The JSON string to parse.
983
+ - typ : type of object to recover (series or frame), default 'frame'
984
+ - orient : The format of the JSON string, one of the following
985
+
986
+ * split : dict like {index -> [index], name -> name, data -> [values]}
987
+ * records : list like [value, ... , value]
988
+ * index : dict like {index -> value}
989
+
990
+ - dtype : dtype of the resulting Series
991
+ - numpy : direct decoding to numpy arrays. default True but falls back to standard decoding if a problem occurs.
992
+
993
+ The parser will raise one of ``ValueError/TypeError/AssertionError `` if the JSON is
994
+ not parsable.
995
+
962
996
.. ipython :: python
963
997
964
998
pd.read_json(s)
0 commit comments