En cours

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);

}

Compétences : Programmation C, Programmation C++

en voir plus : 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

Concernant l'employeur :
( 0 commentaires ) Clackamas, United States

Nº du projet : #19328885

Décerné à:

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 Plus

%selectedBids___i_sum_sub_7% %project_currencyDetails_sign_sub_8% USD en 5 jours
(29 Commentaires)
6.0

18 freelance font une offre moyenne de $486 pour ce travail

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. Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 10 jours
(14 Commentaires)
6.1
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

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 10 jours
(12 Commentaires)
6.2
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.

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 3 jours
(39 Commentaires)
6.3
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 Plus

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(47 Commentaires)
5.4
donghyukchung

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

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 10 jours
(38 Commentaires)
4.9
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. Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 10 jours
(9 Commentaires)
4.8
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 Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 10 jours
(18 Commentaires)
4.7
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 Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 10 jours
(5 Commentaires)
4.1
phamv4n

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

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 3 jours
(13 Commentaires)
4.3
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 Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 5 jours
(4 Commentaires)
3.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

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 7 jours
(8 Commentaires)
3.4
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 Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 8 jours
(2 Commentaires)
2.7
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.

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 5 jours
(2 Commentaires)
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 Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 5 jours
(3 Commentaires)
2.8
huangxiazheng

Thanks for your posting job. I am interested in your job description. let me can you. I have a rich experience in c/c++, java project, vb, etc. I am any time available for the interview, I look forward to having th Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 10 jours
(0 Commentaires)
0.0
Tarekkkkk

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

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 2 jours
(0 Commentaires)
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. Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 3 jours
(0 Commentaires)
0.0