json2sdb.1 (1491B)
1 .TH JSON2SDB 1 2 .SH NAME 3 json2sdb \- convert JSON to simple database format 4 .SH SYNOPSIS 5 .B json2sdb 6 [ 7 .I file 8 ] 9 .SH DESCRIPTION 10 .I Json2sdb 11 reads JSON data and converts it to the simple database (sdb) format. 12 If 13 .I file 14 is given, it reads from that file; otherwise it reads from standard input. 15 .PP 16 The conversion produces sdb records with a hierarchical path structure 17 representing the JSON data organization. Each output line contains: 18 .IP 19 .EX 20 type path[key]=value 21 .EE 22 .PP 23 The type character indicates the data type: 24 .TP 25 .B o 26 JSON object 27 .TP 28 .B a 29 JSON array 30 .TP 31 .B s 32 JSON string value 33 .TP 34 .B n 35 JSON numeric value 36 .PP 37 The path represents the hierarchical location within the JSON structure. 38 Root objects start with a leading dot, while root arrays and primitive values 39 use an empty path. Object properties are separated by dots (.), while array 40 elements are shown with empty square brackets []. String values containing spaces or special 41 characters are quoted according to sdb format rules. 42 .PP 43 Spaces in keys and paths are encoded as plus signs (+), and certain special 44 characters are hex-escaped (=, +) to ensure sdb format compatibility. 45 .SH EXAMPLE 46 .IP 47 .EX 48 % echo '{"name": "alice", "age": 25}' | json2sdb 49 o 50 s .name=alice 51 n .age=25 52 .EE 53 .SH SOURCE 54 .B \*9/src/cmd/sdb/json2sdb.c 55 .SH SEE ALSO 56 .MR json (3) , 57 .MR sdb (1) , 58 .MR sdb (7) , 59 .MR sdbr (3) 60 .SH DIAGNOSTICS 61 .I Json2sdb 62 exits with a non-zero status if JSON parsing fails. 63 Parse errors include the line number and error description.