Comments (6)
"binn_to_string" We should make this possible
from binn.
Hi fanol!
Check the conversions/json
folder. The functions for conversions are there.
You can use this function:
char * binn_to_json(void *binn);
The return value must be freed by the caller using free().
The conversion currently depends on jansson library. I tested with the version 2.3 but you can test with newer ones.
from binn.
Yes I've noticed that but I think a dependency on jansson should be not needed! It should be an independent way to print the binn object to console what do you think?
from binn.
Currently the conversion code supports so export as import from JSON and also to/from jansson objects, what makes it useful for serialized data modifications.
This support may not be abandoned.
If you want you can implement a function to just export data as string without any deps as an alternative.
from binn.
To be clear I don't intended to drop the conversion to json support but I think that should be an independent way to have have a toString() conversion without the need to:
- Convert the binn to a json_object
- Call the json_to_string() method
- Delete the created json
- Free the string itself after have printed it
The fact is that in my code we used json as Message format but now we are finding too much slow as we need to convert it in string to transmit the data and in reception to re-parse the data any time! With big json this could be really slow...
But at same time I find really useful to have the possibility for debug purposes to print the received data as string... now I'm asking myself if reconverting to string the binn to print it will defeat the purpose of binn: the string should be generated and allocated while the json library we use don't need to free the string when we do toString() onto a json_object so I imagine it retains a pointer to it will be faster or in the end nothing will change doing the conversion?
from binn.
Debug does not need to be fast! The current implementation is sufficient for debug purposes.
But if you want a different way, fork the project and make the function in the conversions/string folder.
from binn.
Related Issues (20)
- Sending object to C# TCP server
- Send layers of struct over TCP, possible? HOT 1
- Using binn in C# possible? HOT 1
- aes.hpp superfluous - C++/C has standards support semantics not reflected here. HOT 1
- Specification and version HOT 3
- Missing magic number in specification HOT 4
- Nested objects HOT 1
- Qt Creator can't compile header file (just 1 function) HOT 2
- Setting length of buffer HOT 2
- build issue on mips32 (big endian) HOT 1
- binn_map_get_blob() fails if blob size is 1 byte HOT 1
- Blob size implementation always uses 4-byte block HOT 4
- Performance Benchmark HOT 2
- Iterate over binn obj example HOT 2
- All key names should be "const char*" instead of "char*" HOT 2
- Contador no working?? HOT 2
- Array serialization HOT 1
- unable to create dll in visual studio 2019
- How to properly load and read a binn object from a data buffer without too many allocations? HOT 3
- Donating my Rust implementation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from binn.