Json response start with @ to datatable

I have seen a lot of similar topics but none worked for me, with i receive the http response always start with @ sign,
I try to deserialize it i always get error on line 1

response as below

@"{
    ""C_ID"": ""xxx-12312-xx"",
    ""CustomerName"": ""Test"",
    ""CustomerType"": ""Corporate"",
    ""RiskLevel"": ""Low"",
    ""BranchCode"": ""010"",
    ""CountryOfIncorporation"": ""HK"",
    ""IncomingTerritories"": [
        {
            ""CountryCode"": ""AQ""
        },
        {
            ""CountryCode"": ""BF""
        },
        {
            ""CountryCode"": ""CK""
        },
        {
            ""CountryCode"": ""DK""
        },
        {
            ""CountryCode"": ""FM""
        },
        {
            ""CountryCode"": ""FO""
        },
        {
            ""CountryCode"": ""GP""
        },
        {
            ""CountryCode"": ""MX""
        },
        {
            ""CountryCode"": ""NG""
        },
        {
            ""CountryCode"": ""PN""
        },
        {
            ""CountryCode"": ""SK""
        },
        {
            ""CountryCode"": ""SZ""
        },
        {
            ""CountryCode"": ""TG""
        },
        {
            ""CountryCode"": ""WS""
        }
    ],
    ""OutgoingTerritories"": [
        {
            ""CountryCode"": ""DM""
        },
        {
            ""CountryCode"": ""GQ""
        },
        {
            ""CountryCode"": ""HT""
        },
        {
            ""CountryCode"": ""SN""
        },
        {
            ""CountryCode"": ""YT""
        }
    ],
    ""PaymentForecast"": {
        ""MaxMonthlyPayments"": 0,
        ""MaxSinglePayment"": 0,
        ""VolumePerMonth"": 0
    }
}"

any idea how can i convert this for table that i can use in the flow !

if use desterilize to Json object
JObject(9) { JProperty(1) { [SOL-12312-BC] }, JProperty(1) { [Test] }, JProperty(1) { [Corporate] }, JProperty(1) { [Low] }, JProperty(1) { [010] }, JProperty(1) { [HK] }, JProperty(1) { JArray(14) { JObject(1) { JProperty(1) { [AQ] } }, JObject(1) { JProperty(1) { [BF] } }, JObject(1) { JProperty(1) { [CK] } }, JObject(1) { JProperty(1) { [DK] } }, JObject(1) { JProperty(1) { [FM] } }, JObject(1) { JProperty(1) { [FO] } }, JObject(1) { JProperty(1) { [GP] } }, JObject(1) { JProperty(1) { [MX] } }, JObject(1) { JProperty(1) { [NG] } }, JObject(1) { JProperty(1) { [PN] } }, JObject(1) { JProperty(1) { [SK] } }, JObject(1) { JProperty(1) { [SZ] } }, JObject(1) { JProperty(1) { [TG] } }, JObject(1) { JProperty(1) { [WS] } } } }, JProperty(1) { JArray(5) { JObject(1) { JProperty(1) { [DM] } }, JObject(1) { JProperty(1) { [GQ] } }, JObject(1) { JProperty(1) { [HT] } }, JObject(1) { JProperty(1) { [SN] } }, JObject(1) { JProperty(1) { [YT] } } } }, JProperty(1) { JObject(3) { JProperty(1) { [0] }, JProperty(1) { [0] }, JProperty(1) { [0] } } } }

how i can read this !

Thanks in advance.

  1. Use the Deserialize JSON activity to deserialize the JSON string. In the “JsonString” field, enter the JSON string, and in the “JsonDeserialized” field, create a new variable of type “JObject.”
  2. Use the Assign activity to create a new DataTable variable and assign it the value of the deserialized JSON object.
    For example: dataTableVariable = JsonDeserialized(“dataTableFieldName”).ToObject(Of DataTable)()
  3. This will convert the “dataTableFieldName” property of the deserialized JSON object to a DataTable.
  4. You can now use the resulting DataTable in your UiPath workflow.

Note: The above steps assume that the JSON response contains a single DataTable. If the JSON response contains multiple DataTables or other objects, you may need to modify the code to extract the specific DataTable you want to convert.

Thanks for answering.
do you have example?
im using c#

Regards

Here you go!
ForumQueries.zip (3.1 KB)

Thanks alot now i see why i got confused :slight_smile:

i understood you have the object value and can assign it to datable column value,

can this be dynamic as auto generate table based on object name =column name and object value = row value?

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.