Comments (7)
Yeah, I interested in this too.
I encode data like this
(map with different type values)
{1:11,2:22,3:[{1:123,4:true,9:"text"}]}
or (arrays with different type items)
{1:11,2:22,3:[123,true,"text"]}
How to do this efficiently?
from cbor.
OK, for the first poster why can't you do this
encoder.writeArray([{1:123456789}]);
this decodes to
81a1011a075bcd15
and decodes correctly in cbor.me
Also second poster can you not do this
encoder.writeMap({1:11,2:22,3:[{1:123,4:true,9:"text"}]});
which also works?
from cbor.
Hi,
thank you for your work!
The issue is when working with tags, such as the BigInt()
from cbor.
Yes Ok, I think we need a tag builder package of some sort to assist with tag encoding, we also need some way of assembling a map/list inline, e.g.
open map
add key
add value
add keyValue
close map
so you can do this without using indefinites, does this sound OK, do you have anything else in mind?
from cbor.
Yes, that is absolutely what I was thinking of.
The existing way of doing things can be left untouched.
It would be great if we could use still definite arrays / maps with the open / close principle.
The length of the map / array can be calculated from the actual length of the map / array and encoded after the array / map is closed.
from cbor.
Yep OK I'll start putting together some updates along these lines and see how it pans out.
from cbor.
OK, package updated and re published at version 3.0.0, please have a look at the examples for the new list builder and map builder encoder classes and read the API for docs for these, hopefully we can now better encode lists/maps with complex items without using indefinite sequences.
from cbor.
Related Issues (20)
- runtimeType String checking fails for web release builds HOT 3
- Bad state: No element HOT 2
- Bad state: No element - map tagetSize out of bounds HOT 5
- Changes to the API HOT 7
- Can't find 'simple.dart' HOT 13
- Please provide transition examples from 4.1 to 5.0 HOT 8
- encode int num 43008 decode another num -22528 HOT 4
- CborFloat HOT 3
- Add funding links to package HOT 1
- How does toJson decode Bytes List? HOT 4
- Add repository tag to pubspec HOT 1
- Add codecov to CI/CD HOT 1
- Impossible to get same object between 2 libraries HOT 2
- Split _CborListImpl into _CborDefiniteLengthListImpl and _CborIndefiniteLengthListImpl HOT 3
- FormatException: Expected at most one CBOR value. HOT 5
- Update to Dart 3 HOT 1
- Error: The class 'Sink' can't be extended outside of its library because it's an interface class. HOT 3
- Allow to define Map type while decoding HOT 1
- Any plans to support custom types? HOT 3
- Weird json conversion from cbor HOT 7
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 cbor.