Skip to content

Commit 6fd424d

Browse files
committed
[feat] add jsonlab compatible interfaces, bump to 0.7.1
1 parent 7146d93 commit 6fd424d

File tree

5 files changed

+65
-3
lines changed

5 files changed

+65
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
- Copyright: (C) Qianqian Fang (2019-2025) <q.fang at neu.edu>
66
- License: Apache License, Version 2.0
7-
- Version: 0.7.0
7+
- Version: 0.7.1
88
- URL: https://github.com/NeuroJSON/pyjdata
99
- Acknowledgement: This project is supported by US National Institute of Health (NIH)
1010
grant [U24-NS124027](https://reporter.nih.gov/project-details/10308329)

jdata/__init__.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@
3434
"""
3535

3636
from .jfile import (
37+
loadjson,
38+
savejson,
39+
loadbj,
40+
savebj,
41+
loadjd,
42+
savejd,
3743
load,
3844
save,
3945
loadurl,
@@ -50,6 +56,8 @@
5056
jext,
5157
)
5258
from .jdata import (
59+
jdataencode,
60+
jdatadecode,
5361
encode,
5462
decode,
5563
jdtype,
@@ -82,8 +90,16 @@
8290
)
8391
from .h5 import loadh5, saveh5
8492

85-
__version__ = "0.7.0"
93+
__version__ = "0.7.1"
8694
__all__ = [
95+
"loadjson",
96+
"savejson",
97+
"loadbj",
98+
"savebj",
99+
"loadjd",
100+
"savejd",
101+
"jdataencode",
102+
"jdatadecode",
87103
"load",
88104
"save",
89105
"loadurl",

jdata/jdata.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
__all__ = [
99
"encode",
1010
"decode",
11+
"jdataencode",
12+
"jdatadecode",
1113
"jdtype",
1214
"jsonfilter",
1315
"zlibencode",
@@ -588,3 +590,17 @@ def base64decode(buf):
588590

589591

590592
# -------------------------------------------------------------------------------------
593+
594+
595+
def jdataencode(obj, **kwargs):
596+
return encode(obj, **kwargs)
597+
598+
599+
# -------------------------------------------------------------------------------------
600+
601+
602+
def jdatadecode(obj, **kwargs):
603+
return decode(obj, **kwargs)
604+
605+
606+
# -------------------------------------------------------------------------------------

jdata/jfile.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
"""
66

77
__all__ = [
8+
"loadjson",
9+
"savejson",
10+
"loadbj",
11+
"savebj",
12+
"loadjd",
13+
"savejd",
814
"load",
915
"save",
1016
"loadurl",
@@ -509,3 +515,27 @@ def downloadlink(uripath, opt={}, **kwargs):
509515
if ext in jext["t"] or ext in jext["b"]:
510516
newdata = jd.load(fname, opt)
511517
return newdata, fname, cachepath
518+
519+
520+
def loadjson(fname, **kwargs):
521+
return loadt(fname, **kwargs)
522+
523+
524+
def savejson(fname, **kwargs):
525+
return savet(fname, **kwargs)
526+
527+
528+
def loadbj(fname, **kwargs):
529+
return loadb(fname, **kwargs)
530+
531+
532+
def savebj(fname, **kwargs):
533+
return saveb(fname, **kwargs)
534+
535+
536+
def loadjd(fname, **kwargs):
537+
return load(fname, **kwargs)
538+
539+
540+
def savejd(fname, **kwargs):
541+
return save(fname, **kwargs)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
setup(
77
name="jdata",
88
packages=["jdata"],
9-
version="0.7.0",
9+
version="0.7.1",
1010
license="Apache license 2.0",
1111
description="Encoding and decoding Python data structrues using portable JData-annotated formats",
1212
long_description=readme,

0 commit comments

Comments
 (0)