How to send an object array from c# to javascript?

How to send an object array from c# to javascript?

Im trying to send an array that contains some objects via connection made in SignalR, the connection is not a problem, everything works fine. When the data arrives to the view it is no longer the array i need to use. This is the class:

Im trying to send an array that contains some objects via connection made in SignalR, the connection is not a problem, everything works fine. When the data arrives to the view it is no longer the array i need to use. This is the class:

public class Empresa
    {
        public string nombre { get; set; }
        public int vidID { get; set; }
        public string img64 { get; set; }
        public string color { get; set; }

}

At the end the object will be something like this:

The object is send to the view and this is the output:

I have already tried with JsonConvert.SerializeObjectas i found on other threads, yet it doesnt seems to work. I tried to convert the data send with this jQuery.parseJSON(data) (Left) and with this JSON.parse(data)(Right); it throws an error on both cases as seen in the picture below.

I'm not sure if it is that way because the object sended is made this way:

private readonly ConcurrentDictionary<int, Empresa> _ar1 = new ConcurrentDictionary<int, Empresa>();

var data = new List<Empresa> { new Empresa{nombre ="Globex Corp",color="red",vidId=1, img="data:image/jpeg;base64,blabla" }, new Empresa{nombre ="AM",color="blue",vidId=2, img="data:image/jpeg;base64,blabla" } } for(int i = 0; i<=6; i++) { _ar1.TryAdd(data[i].vidID, data[i]); }

This is inside other function but it is the next one that involves the data send.

public IEnumerable<Empresa> GetArreglo()
        {
           return _ar1;
        }

So far im not sure what could be wrong or if i need to aproach a different solution. If any more info is needed ill post it. And even it is obvious im a newby still learning on this.

javascript c-sharp jquery json

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

C. C++. C#. 차이점 알려드림. 5분 순삭. Explain C.C++.C#. Like I'm Five

C. C++. C#. 차이점 알려드림. 5분 순삭. Explain C.C++.C#. Like I'm Five. 아시죠? C는 C++.C# 줄인말이 아니라는거?

Learn how to perform CRUD operations using C Sharp

QuickStart: CRUD Operations in C Sharp. Learn how to perform CRUD operations using C Sharp for MongoDB databases.

Mapping JSON to and from a C++ Structure

Full tutorial on how to map JSON to and from a C++ structure—including installation, usage, and exceptions. Mapping JSON to and from a C++ Structure. StructMapping is a header-only C++ library. All library files are in the include folder.

Loops in C++ | For, While, and Do While Loops in C++

In this Video We are going to see how to use Loops in C++. We will see How to use For, While, and Do While Loops in C++.

Using isdigit() in C/C++

In this article, we'll take a look at using the isdigit() function in C/C++. This is a very simple way to check if any value is a digit or not. Let's look