From 994724d35fca1a52dc07b6c27d28635f57e1db28 Mon Sep 17 00:00:00 2001 From: Russ Webber Date: Fri, 10 Jan 2025 11:14:39 +1100 Subject: [PATCH] fix: json import attributes at the frame level --- src/canmatrix/formats/json.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/canmatrix/formats/json.py b/src/canmatrix/formats/json.py index 7ce56b04..75d2ef95 100644 --- a/src/canmatrix/formats/json.py +++ b/src/canmatrix/formats/json.py @@ -233,8 +233,14 @@ def load(f, **_options): new_frame.pdu_name = frame[key] new_frame.arbitration_id.extended = frame.get("is_extended_frame", False) + + if "attributes" in frame: + for k, v in frame["attributes"].items(): + new_frame.add_attribute(k, v) + if "transmitters" in frame: new_frame.transmitters = frame["transmitters"] + for signal in frame["signals"]: is_little_endian = not signal.get("is_big_endian", False) is_float = signal.get("is_float", False)