Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
1.33/5 (3 votes)
See more:
how can i send and receive json data between C# and C++.

i have a json data in my c# code and i need to send the data to c++ and as a replay i need to send another json data to c#.
could some one please explain how can i do this using C++/CLI wrapper.

What I have tried:

i don't have a clear idea on how to send the JSON data between managed and unmanaged code .please help me on this.
Posted
Updated 6-Nov-17 2:01am
Comments
Mehdi Gholam 6-Nov-17 7:02am    
Send where? In the same process? to a different process? or to another machine?
Member 13147452 6-Nov-17 23:08pm    
i have a server code which is C# and i am adding the C++ DLL as reference. i need to send a json file from the C# code to C++ .

1 solution

When it is in the same app than you best use C# interop and make a call by using the jason as string parameter. Read my article and code Calling all stations.

If it are different apps it gets a bit difficulter. Writing an temporary file or shared memory is best for on the same machine.
 
Share this answer
 
Comments
Member 13147452 6-Nov-17 23:07pm    
i have a server code which is C# and i am adding the C++ DLL as reference. i need to send a json file from the C# code to C++ .

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900