# 'Unknown datatype: JSON.' in ADO.NET Provider for Presto

**URL:** <https://community.cdata.com/t/unknown-datatype-json-in-ado-net-provider-for-presto/533>\
**Category:** CData Drivers\
**Tags:** question, ado.net\
**Created:** [November 22, 2023, 6:25pm UTC](https://community.cdata.com/t/unknown-datatype-json-in-ado-net-provider-for-presto/533 "2023-11-22T18:25:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rocketmaniac](https://avatars.discourse-cdn.com/v4/letter/r/43a26b/32.png) [@rocketmaniac](https://community.cdata.com/u/rocketmaniac)\
**Post date:** [November 22, 2023, 6:25pm UTC](https://community.cdata.com/t/unknown-datatype-json-in-ado-net-provider-for-presto/533/1 "2023-11-22T18:25:15Z")

</div>

I’m getting the following exception when trying to run the following code.&nbsp; Does the driver support the Trino JSON type?&nbsp; I don’t see json referenced in GetResultTypeData method source.

```csharp
string sql = "SELECT _id, CAST(extra_columns AS JSON) as extra_columns FROM hive.default.measures";PrestoCommand cmd = new PrestoCommand(sql, connection);PrestoDataReader rdr = cmd.ExecuteReader();

```

```auto
  Message: Test method Juniper.Test.Trino.TrinoClientTests.PrestoAdoRead threw exception: System.Data.CData.Presto.PrestoException: [500] Could not execute the specified command: Unknown datatype: JSON. ---> oro230j.TC: Unknown datatype: JSON. Stack Trace: ZN.GetResultDataType(FormulaEvaluationContext )RqC.K(SqlFormulaColumn )RqC.mI(SqlTable , SqlColumn )Rod.C(SqlCollection`1 )Rod.Nd(LLB`2 )Roh.Nd(LLB`2 )KJ.U(SQLQuery , Int32 , RRq )KJ.d(IDataStatement , SQLQuery , QueryParameterCollection , Int32 , String , LeW )RUJ.ExecuteQuery(IDataStatement , QueryParameterCollection , Int32 )RUG.ExecuteQuery(IDataStatement , QueryParameterCollection , Int32 )<9 more frames...>PrestoCommand.ExecuteDataReader(CommandBehavior behavior)PrestoCommand.ExecuteDbDataReader(CommandBehavior behavior)DbCommand.ExecuteReader()PrestoCommand.ExecuteReader()<PrestoAdoRead>d__5.MoveNext() line 106--- End of stack trace from previous location where exception was thrown ---ExceptionDispatchInfo.Throw()TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)TaskAwaiter.GetResult()ThreadOperations.ExecuteWithAbortSafety(Action action)

```

---

<div class="post-metadata">

**Author:** ![Ethem\_Q](https://sea3.discourse-cdn.com/cdata/user_avatar/community.cdata.com/ethem_q/32/1997_2.png) [@Ethem\_Q](https://community.cdata.com/u/Ethem_Q)\
**Post date:** [November 22, 2023, 8:14pm UTC](https://community.cdata.com/t/unknown-datatype-json-in-ado-net-provider-for-presto/533/2 "2023-11-22T20:14:29Z")

</div>

Our SQL engine does not support casting to a JSON type at this time. However, this looks like a syntax that Presto does support so to work around the issue here you might want to use NativeQuery.

```sql
SELECT * FROM NativeQuery(‘SELECT id, CAST(extra_columns AS JSON) FROM [TableName]’)

```

You can read more about it here: [https://community.cdata.com/editions-90/using-nativequery-568?tid=568&fid=90](https://community.cdata.com/editions-90/using-nativequery-568?tid=568&fid=90)

In case you have any other questions or issues feel free to send those over at&nbsp;[support@cdata.com](mailto:support@cdata.com)&nbsp;or you can always submit a support case&nbsp;[here](https://www.cdata.com/support/submit.aspx).
