<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: JSONDecodeError when trying an operation in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/jsondecodeerror-when-trying-an-operation/m-p/1676649#M11837</link>
    <description>&lt;P&gt;I have found that the pd.DataFrame.spatial.from_layer() method is wildly inconsistent and often has little-to-no helpful traceback for debugging when it randomly decides to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would recommend using the query method on the layers instead. You can include the "as_df=True" argument or call the ".sdf" attribute of the queried featureset after the fact. When I tested just now, this method worked fine.&lt;/P&gt;</description>
    <pubDate>Thu, 08 Jan 2026 12:04:00 GMT</pubDate>
    <dc:creator>AustinAverill</dc:creator>
    <dc:date>2026-01-08T12:04:00Z</dc:date>
    <item>
      <title>JSONDecodeError when trying an operation</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/jsondecodeerror-when-trying-an-operation/m-p/1668437#M11791</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;I'm trying to use ArcGIS API for Python to run a simple query on two layers from the same service.&lt;/P&gt;&lt;P&gt;&lt;A href="https://arcgisv11.sea.gob.cl/server/rest/services/WEBServices/ProyectosSEIA/MapServer" target="_blank"&gt;https://arcgisv11.sea.gob.cl/server/rest/services/WEBServices/ProyectosSEIA/MapServer&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LeandroZamudio_0-1764077975939.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/144384i653B7E72FC8386C5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LeandroZamudio_0-1764077975939.png" alt="LeandroZamudio_0-1764077975939.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Using this sample code I try to create a dataframe from the layer data and it works the EIA layer (1) but not in DIA layer (2) even if the layers are almost identical&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import pandas as pand
from arcgis.gis import GIS
from arcgis.features import GeoAccessor, GeoSeriesAccessor, FeatureLayerCollection

gis = GIS()
fs_url=r"https://arcgisv11.sea.gob.cl/server/rest/services/WEBServices/ProyectosSEIA/MapServer"
coleccioncapas = FeatureLayerCollection(fs_url)
Capas=coleccioncapas.layers
#for capa in Capas:
#    print(capa.properties.name)
capa_data=Capas[1]
df_data = pand.DataFrame.spatial.from_layer(capa_data)
print(df_data.head(5))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That's the error.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\urllib3\connectionpool.py:1097: InsecureRequestWarning: Unverified HTTPS request is being made to host 'arcgisv11.sea.gob.cl'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings
  warnings.warn(
C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\urllib3\connectionpool.py:1097: InsecureRequestWarning: Unverified HTTPS request is being made to host 'arcgisv11.sea.gob.cl'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings
  warnings.warn(
Traceback (most recent call last):
  File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\requests\models.py", line 974, in json
    return complexjson.loads(self.text, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\features\geo\_accessor.py", line 2683, in from_layer
    return from_layer(layer=layer)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\features\geo\_io\serviceops.py", line 186, in from_layer
    sdf = layer.query(where=query, as_df=True)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\features\layer.py", line 2257, in query
    ).execute()
      ^^^^^^^^^
  File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\_impl\common\_query.py", line 658, in execute
    return self._query(raw)
           ^^^^^^^^^^^^^^^^
  File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\_impl\common\_query.py", line 679, in _query
    return self._handle_query_exception(query_exception)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\_impl\common\_query.py", line 843, in _handle_query_exception
    raise query_exception
  File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\_impl\common\_query.py", line 677, in _query
    return self._process_query_result(result, raw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\_impl\common\_query.py", line 711, in _process_query_result
    features = self._fetch_all_features_by_chunk()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\_impl\common\_query.py", line 829, in _fetch_all_features_by_chunk
    result = future.result().json()
             ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\requests\models.py", line 978, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "d:\Code\core-python-jupiter\pruebas\testing.py", line 12, in &amp;lt;module&amp;gt;
    df_data = pand.DataFrame.spatial.from_layer(capa_data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\features\geo\_accessor.py", line 2687, in from_layer
    raise Exception(
Exception: Malformed response from server, could not load the dataset: Expecting value: line 1 column 1 (char 0)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Nov 2025 13:48:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/jsondecodeerror-when-trying-an-operation/m-p/1668437#M11791</guid>
      <dc:creator>Leandro-Zamudio</dc:creator>
      <dc:date>2025-11-25T13:48:32Z</dc:date>
    </item>
    <item>
      <title>Re: JSONDecodeError when trying an operation</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/jsondecodeerror-when-trying-an-operation/m-p/1676649#M11837</link>
      <description>&lt;P&gt;I have found that the pd.DataFrame.spatial.from_layer() method is wildly inconsistent and often has little-to-no helpful traceback for debugging when it randomly decides to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would recommend using the query method on the layers instead. You can include the "as_df=True" argument or call the ".sdf" attribute of the queried featureset after the fact. When I tested just now, this method worked fine.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jan 2026 12:04:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/jsondecodeerror-when-trying-an-operation/m-p/1676649#M11837</guid>
      <dc:creator>AustinAverill</dc:creator>
      <dc:date>2026-01-08T12:04:00Z</dc:date>
    </item>
  </channel>
</rss>

