Are you getting any error during DXFIN, or when opening the DXF file ?
If there was problem reading the strings, I would expect it to manifest in the LISP (entmake) function as well, but it doesn't seem to have any problem with your json string:
Command: (setq strdata (getstring T))
{"Setups":[{"Name":"Default","Default":[1,2,4,8,16],"ID":"00000000-0000-0000-0000-000000000000","Steps":[]}],"SelectedID":"00000000-0000-0000-0000-000000000000"}
"{\"Setups\":[{\"Name\":\"Default\",\"Default\":[1,2,4,8,16],\"ID\":\"00000000-0000-0000-0000-000000000000\",\"Steps\":[]}],\"SelectedID\":\"00000000-0000-0000-0000-000000000000\"}"
Command: (princ strdata)
{"Setups":[{"Name":"Default","Default":[1,2,4,8,16],"ID":"00000000-0000-0000-0000-000000000000","Steps":[]}],"SelectedID":"00000000-0000-0000-0000-000000000000"}"
Command: (setq xrecord (entmakex (list (cons 0 "XRECORD") (cons 100 "AcDbXrecord") (cons 1 strdata))))
<Entity name: 7ffffb0c6e0>
Command: (entget xrecord)
((-1 . <Entity name: 7ffffb0c6e0>) (0 . "XRECORD") (330 . <Entity name: 0>) (5 . "286") (100 . "AcDbXrecord") (280 . 1) (1 . "{\"Setups\":[{\"Name\":\"Default\",\"Default\":[1,2,4,8,16],\"ID\":\"00000000-0000-0000-0000-000000000000\",\"Steps\":[]}],\"SelectedID\":\"00000000-0000-0000-0000-000000000000\"}"))
Command: (setq str (cdr (assoc 1 (entget xrecord))))
"{\"Setups\":[{\"Name\":\"Default\",\"Default\":[1,2,4,8,16],\"ID\":\"00000000-0000-0000-0000-000000000000\",\"Steps\":[]}],\"SelectedID\":\"00000000-0000-0000-0000-000000000000\"}"
Command: (eq str strdata)
T
@antti.kujala wrote:
Hi,
We are storing data as JSON format in the DBObjects extension dictionaries. Everything is working well except when the dwg is saved as dxf. The saved dxf file cannot be opened by the autocad as the xrecord entries containing the JSON cannot be read. The AcDbXrecord in dxf looks something like this.
AcDbXrecord
280
1
1
{"Setups":[{"Name":"Default","Default":[1,2,4,8,16],"ID":"00000000-0000-0000-0000-000000000000","Steps":[]}],"SelectedID":"00000000-0000-0000-0000-000000000000"}
0
XRECORD
5
25B
102
{ACAD_REACTORS
330
25A
102
}
330
25A
100
The problem seems to be the '{' and '}' characters int he JSON format. Is the only way to replace the characters in the JSON string with something else ? Or is there a better solution ?