Cancelled

Serialize C header structures to/from json

I have around 40 header files containing data structures the I need to be able to convert to and from json. I have an existing framework/base class that is based on RapidJson that simplifies the process and matches my needs. Most of the data structures are fairly simple. There are a few that are more involved and have embedded arrays or other embedded structures.

The base class mostly encapsulates and hides the json library, however for the few structures that are more complicated, you may need to extend the base class to include additional functionality (for which you will probably need to spend some time learning how to work with RapidJson).

You will receive the framework, the source header files, and data files to test with. One of the header files is already converted to show how it works as an example. You will complete a subclass for each source header file that performs the serialization and passes the associated test data file.

No specific development environment is required, any relatively modern c++ compiler will work as long as it can compile RapidJson ([login to view URL]).

The following is an example of what a simple translation would look like:

//---------------------------------------------------------------------------

typedef struct

{ unsigned short id;

char name[15];

unsigned short data1;

unsigned short data2;

unsigned short data3;

#define options1_value1 0x0001

#define options1_value2 0x0002

unsigned short options1;

} example_struct;

//---------------------------------------------------------------------------

class TBinaryRecordToJson_Example : public TBinaryRecordToJson

{

public:

virtual bool ToJson(const void *Buffer,int BufferSize,std::string &Json);

virtual bool ToBinary(const std::string &Json,void *Buffer,int BufferSize);

};

//---------------------------------------------------------------------------

bool TBinaryRecordToJson_Example::ToJson(const void *Buffer,int BufferSize,std::string &Json)

{ example_struct *R=(example_struct *)Buffer;

std::vector<std::string> Options;

if (R->options1&options1_value1)

Options.push_back("options1_value1");

if (R->options1&options1_value2)

Options.push_back("options1_value2");

ResetJson();

JsonAddValue_int("id",R->id);

JsonAddValue_string("name",R->name);

JsonAddValue_int("data1",R->data1);

JsonAddValue_int("data2",R->data2);

JsonAddValue_int("data3",R->data3);

JsonAddArray_string("options",Options);

GetJson(Json);

return(true);

}

//---------------------------------------------------------------------------

bool TBinaryRecordToJson_Example::ToBinary(const std::string &Json,void *Buffer,int BufferSize)

{ example_struct R;

memset(&R,0,sizeof(R));

std::vector<std::string> Options;

ParseJson(Json);

JsonGetValue_unsigned_short("id",[login to view URL]);

JsonGetValue_string("name",[login to view URL],sizeof([login to view URL]));

JsonGetValue_unsigned_short("data1",[login to view URL]);

JsonGetValue_unsigned_short("data2",[login to view URL]);

JsonGetValue_unsigned_short("data3",[login to view URL]);

JsonGetArray_string("options",Options);

for (std::vector<std::string>::iterator it=[login to view URL](); it!=[login to view URL](); ++it)

{ if (*it=="options1_value1")

[login to view URL]|=options1_value1;

else if (*it=="options1_value2")

[login to view URL]|=options1_value2;

}

memcpy(Buffer,&R,sizeof(R));

return(true);

}

Skills: C Programming, C++ Programming

See more: environment web header image, json serialize, header group json, c library write json, json-c, create json string in c, c struct generator, serialize c struct to json, embedded c++ json, json.c file, frozen json c, scrollable table header android json data, c data structures, c++ data structures, c data structures and algorithms, c data structures library, c data structures tutorial, c# data structures tutorial, c data structures tutorials, compile and execute c online

About the Employer:
( 0 reviews ) Clackamas, United States

Project ID: #19328885

Awarded to:

NewHorizons2016

Hi there, I have extensive C++ experience, and teach C++ too. Having worked with all sorts of data formats, including JSON, XML etc - for nearly 20 years, this should be a relatively straight-forward task. Let m More

$350 USD in 5 days
(31 Reviews)
6.0

17 freelancers are bidding on average $482 for this job

bianyunzhi95

I hope to see you in chat. I am an experienced c++ developer with full-stack knowledge and career. I'm sure I can do this perfectly. Thanks for your kind attention.

$500 USD in 3 days
(40 Reviews)
6.3
AwaisChaudhry

Hi there, I have checked the details I have great experience with C Programming, C++ Programming. Please start the chat so we can discuss this job more in detail. Thanks

$555 USD in 10 days
(13 Reviews)
6.3
ITPyramid85

hello,how are you. i read your bid carefully. i am c/c++, json expert and have full experience for 10 years. c/c++, json is my top skill and i can give you perfect result. i can provide most quality and high speed. More

$500 USD in 10 days
(14 Reviews)
6.1
valor312

Hi there, The problem is a very simple one. I have good hands on C++ and algorithm & data structure, client/server programming. I have deep understanding of Compiler theory, OOP principles, design patterns, U More

$300 USD in 1 day
(53 Reviews)
5.5
goldsea808

hello,how are you. i read your bid carefully. i am c/c++, json expert and have full experience for 10 years. c/c++, json is my top skill and i can give you perfect result. i can provide most quality and high speed. More

$500 USD in 10 days
(11 Reviews)
5.8
donghyukchung

Dear client. Very interesting in your project. I can perfectly complete your project in good time. Please give me a message. Thanks.

$500 USD in 10 days
(39 Reviews)
4.9
xinglong717

Hi, How are you today? I have just read your job description carefully and I am very interesting in your job. I am a senior C,C++ ,C# developer with 10 years experiences and I have developed many program of using in More

$555 USD in 10 days
(20 Reviews)
4.8
adampohp79

Hi Dear client! I have read your requirement and I am very interested in your project. Seems to be an interesting work and good opportunity to show my skills to work with you in future as well. I'm a professional More

$555 USD in 10 days
(5 Reviews)
4.1
phamv4n

!!!!!!!!!!!!!!!!!!!!!!!!!! C++ Master with experience in Serialization/Deserialization !!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!! C++ Master with experience in Serialization/Deserialization !!!!!!!!!!!!!!!! More

$300 USD in 3 days
(13 Reviews)
4.3
mostafaali80

Hi, I'm experienced C/C++ developer with a special knowledge of writing object oriented code. So I can help you with this task. Kind regards, Mostafa

$555 USD in 7 days
(13 Reviews)
3.7
dreamci

Nice to meet you We are top quality full-stack developers and we are ready to work on this project, we use Version Control Systems, Staging Servers, Team Slack Channel and Task Management Tool Our current rate is More

$555 USD in 5 days
(4 Reviews)
3.3
malikasad079

I thought myself a good match and send my resume for your review. It shows my background in the C Programming, C++ Programming developer field closely aligns with what Kiwi is looking for.I can done your project as you More

$472 USD in 8 days
(3 Reviews)
3.1
tulga0911

hi, sir. I just read about your project. I have experiences with C/C++ I am ready to discuss with you about your project. Reward.

$333 USD in 5 days
(2 Reviews)
1.9
Panggumsok

Hello! Hope you are doing well sir! I have read your requirement & sample codes carefully and I consider myself expert and experience in c++ development and can do your project. I have more than 5 year experiences More

$555 USD in 5 days
(3 Reviews)
2.8
Tarekkkkk

I will make what you want In just 2 days on time my salary is able to be discussed .Let's co-operate ;

$555 USD in 2 days
(0 Reviews)
0.0
mg1324

Hi, there. I saw your project and it is very interesting to me. I think it's very important to verify type of values from structure in this project. It's very simple to me, I'll satisfy you enough. Best regards. More

$555 USD in 3 days
(0 Reviews)
0.0