Đang Thực Hiện

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

}

Kĩ năng: Lập trình C, Lập trình C++

Xem nhiều hơn: 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

Về Bên Thuê:
( 0 nhận xét ) Clackamas, United States

ID dự án: #19328885

Được trao cho:

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 Thêm

$350 USD trong 5 ngày
(29 Đánh Giá)
6.0

18 freelancer đang chào giá trung bình $486 cho công việc này

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. Thêm

$500 USD trong 10 ngày
(14 Nhận xét)
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

$555 USD trong 10 ngày
(12 Nhận xét)
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.

$500 USD trong 3 ngày
(39 Nhận xét)
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 Thêm

$300 USD trong 1 ngày
(47 Nhận xét)
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.

$500 USD trong 10 ngày
(38 Nhận xét)
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. Thêm

$500 USD trong 10 ngày
(9 Nhận xét)
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 Thêm

$555 USD trong 10 ngày
(18 Nhận xét)
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 Thêm

$555 USD trong 10 ngày
(5 Nhận xét)
4.1
phamv4n

!!!!!!!!!!!!!!!!!!!!!!!!!! C++ Master with experience in Serialization/Deserialization !!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!! C++ Master with experience in Serialization/Deserialization !!!!!!!!!!!!!!!! Thêm

$300 USD trong 3 ngày
(13 Nhận xét)
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 Thêm

$555 USD trong 5 ngày
(4 Nhận xét)
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

$555 USD trong 7 ngày
(8 Nhận xét)
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 Thêm

$472 USD trong 8 ngày
(2 Nhận xét)
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.

$333 USD trong 5 ngày
(2 Nhận xét)
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 Thêm

$555 USD trong 5 ngày
(3 Nhận xét)
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 Thêm

$555 USD trong 10 ngày
(0 Nhận xét)
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 ;

$555 USD trong 2 ngày
(0 Nhận xét)
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. Thêm

$555 USD trong 3 ngày
(0 Nhận xét)
0.0