Repository: pydicom/pydicom

Issue:
from_json does not correctly convert BulkDataURI's in SQ data elements
**Describe the bug**
When a DICOM object contains large data elements in SQ elements and is converted to JSON, those elements are correctly turned into BulkDataURI's. However, when the JSON is converted back to DICOM using from_json, the BulkDataURI's in SQ data elements are not converted back and warnings are thrown.

**Expected behavior**
The BulkDataURI's in SQ data elements get converted back correctly.

**Steps To Reproduce**
Take the `waveform_ecg.dcm` in the test data, convert it to JSON, and then convert the JSON to DICOM

**Your environment**
module       | version
------       | -------
platform     | macOS-10.15.7-x86_64-i386-64bit
Python       | 3.8.2 (v3.8.2:7b3ab5921f, Feb 24 2020, 17:52:18)  [Clang 6.0 (clang-600.0.57)]
pydicom      | 2.1.0
gdcm         | _module not found_
jpeg_ls      | _module not found_
numpy        | _module not found_
PIL          | _module not found_

The problem is in `jsonrep.py` at line 227. I plan on submitting a pull-request today for this.

Discussion:
codecov[bot]: # [Codecov](https://codecov.io/gh/pydicom/pydicom/pull/1256?src=pr&el=h1) Report
> Merging [#1256](https://codecov.io/gh/pydicom/pydicom/pull/1256?src=pr&el=desc) into [master](https://codecov.io/gh/pydicom/pydicom/commit/49a3da4a3d9c24d7e8427a25048a1c7d5c4f7724?el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pydicom/pydicom/pull/1256/graphs/tree.svg?width=650&height=150&src=pr&token=YciLV15Lwr)](https://codecov.io/gh/pydicom/pydicom/pull/1256?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master    #1256   +/-   ##
=======================================
  Coverage   95.15%   95.15%           
=======================================
  Files          57       57           
  Lines        9297     9297           
=======================================
  Hits         8847     8847           
  Misses        450      450           
```


| [Impacted Files](https://codecov.io/gh/pydicom/pydicom/pull/1256?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pydicom/jsonrep.py](https://codecov.io/gh/pydicom/pydicom/pull/1256/diff?src=pr&el=tree#diff-cHlkaWNvbS9qc29ucmVwLnB5) | `93.69% <ø> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pydicom/pydicom/pull/1256?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pydicom/pydicom/pull/1256?src=pr&el=footer). Last update [49a3da4...0e803d7](https://codecov.io/gh/pydicom/pydicom/pull/1256?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/pydicom/jsonrep.py b/pydicom/jsonrep.py
index c6ef519c3..52bf00ce0 100644
--- a/pydicom/jsonrep.py
+++ b/pydicom/jsonrep.py
@@ -226,7 +226,8 @@ class JsonDataElementConverter:
                     value_key = unique_value_keys[0]
                     elem = DataElement.from_json(
                         self.dataset_class, key, vr,
-                        val[value_key], value_key
+                        val[value_key], value_key,
+                        self.bulk_data_element_handler
                     )
                 ds.add(elem)
         return ds


Test patch:
diff --git a/pydicom/tests/test_json.py b/pydicom/tests/test_json.py
index e18505771..5616f8b2d 100644
--- a/pydicom/tests/test_json.py
+++ b/pydicom/tests/test_json.py
@@ -354,3 +354,25 @@ class TestBinary:
         ds = Dataset().from_json(json.dumps(json_data), bulk_data_reader)
 
         assert b'xyzzy' == ds[0x00091002].value
+
+    def test_bulk_data_reader_is_called_within_SQ(self):
+        def bulk_data_reader(_):
+            return b'xyzzy'
+
+        json_data = {
+            "003a0200": {
+                "vr": "SQ", 
+                "Value": [
+                    {
+                        "54001010": {
+                            "vr": "OW",
+                            "BulkDataURI": "https://a.dummy.url"
+                        }
+                    }
+                ]
+            }
+        }
+
+        ds = Dataset().from_json(json.dumps(json_data), bulk_data_reader)
+
+        assert b'xyzzy' == ds[0x003a0200].value[0][0x54001010].value