System.Text and System.Text.Json -Assembly reference missing

I am getting this error in my Business Process "The type or namespace name 'Json' does not exist in the namespace 'System.Text' (are you missing an assembly reference?)". 

Briefly- The Business Process connects to a REST API, reads a Collection of Objects and stores the data in Creatio Object. 

using System;
using System.IO;
using System.Net;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using Terrasoft.Core;
using Terrasoft.Core.DB;
using Terrasoft.Core.Entities;
using Terrasoft.Core.Configuration;

public void ProcessDataFromAPIResponse()
    var stuff = UserConnection.EntitySchemaManager.GetInstanceByName("UsrEntity_Schema").CreateEntity(UserConnection);
    HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://**************************************");
            request.Method = "POST";
            request.ContentType = "application/json";
            string postData = "";
            byte[] bytes = Encoding.UTF8.GetBytes(postData);
            request.ContentLength = bytes.Length;

            Stream requestStream = request.GetRequestStream();
            requestStream.Write(bytes, 0, bytes.Length);
    var httpResponse = (HttpWebResponse) request.GetResponse();
    var streamReader = new StreamReader(httpResponse.GetResponseStream());
                string result = streamReader.ReadToEnd().ToString();
                var doc = System.Text.Json.JsonDocument.Parse(result);
                System.Text.Json.JsonElement root = doc.RootElement;

                var applns = root.EnumerateArray();

                while (applns.MoveNext())
                    var appln = applns.Current;
                    var props = appln.EnumerateObject();
                        var prop = props.Current;
                        if(prop.Name=="FirstName" )
                                stuff.SetColumnValue("UsrFirstName", prop.value);
                        if(prop.Name == "LastName" )
                                stuff.SetColumnValue("UsrLastName", prop.value);
                        if(prop.Name == "BusinessPhone")
                        if(prop.Name == "EmployeesCanada")
                                stuff.SetColumnValue("UsrCAEmployees", Convert.ToInt32(prop.value));
                        if( prop.Name == "TotalGrossRevenueCurrent" )
                                stuff.SetColumnValue("UsrSalesRevenue", Convert.ToDecimal(prop.value));
                       if( prop.Name == "id" )
                                stuff.SetColumnValue("UsrApplnId", Convert.ToDecimal(prop.value));
                            stuff.Save(false, false);


Like 0



I don't believe Creatio uses the necessary .NET version to include System.Text.Json - IIRC I believe that is in .NET 6 and for earlier versions the NuGet package is available. 

You could change the JSON handling to use the Newtonsoft Json.Net library which is included in Creatio or try adding the assembly from the NuGet package as a DLL in your package (I'd go the route of using the Newtonsoft library)


Ryan Farley,

Ok, I will try with 

Newtonsoft Json.Net library. Thanks Ryan


Show all comments