|
|
Comments and Discussions
|
|
 |
|
|

|
Glad to see that some still think performance is important
|
|
|
|

|
Thanks Espen!
Hopefully the "Microsoft"s and "Oracle"s will think so to and stop producing bloated products
Its the man, not the machine - Chuck Yeager
If at first you don't succeed... get a better publicist
If the final destination is death, then we should enjoy every second of the journey.
|
|
|
|

|
Scott Hanselman: "Tiny Happy Features #2 - ASP.NET Web API in Visual Studio 2012," pubished August 11[^].
See the comment dated: Saturday, August 11, 2012 4:22:13 PM UTC, on this blog entry.
best, Bill
"Everything we call real is made of things that cannot be regarded as real." Niels Bohr
|
|
|
|

|
I am truly flattered, Bill!
Its the man, not the machine - Chuck Yeager
If at first you don't succeed... get a better publicist
If the final destination is death, then we should enjoy every second of the journey.
|
|
|
|

|
Thanks for posting that link on Scott's site, thanks to you I'm discovering these amazing libraries!
Take care,
Renaud
modified 12 Aug '12 - 10:54.
|
|
|
|
|
|

|
Thanks!
Its the man, not the machine - Chuck Yeager
If at first you don't succeed... get a better publicist
If the final destination is death, then we should enjoy every second of the journey.
|
|
|
|

|
var t = DateTime.Today;
var bb = BJSON.Instance.ToJSON(t);
var t2 = BJSON.Instance.ToObject(bb);
t is not Equals t2
|
|
|
|

|
private void WriteDateTime(DateTime dateTime)
{
DateTime dt = dateTime;
//dt = dateTime.ToUniversalTime(); is ok!!
_output.WriteByte(TOKENS.DATETIME);
byte[] b = Helper.GetBytes(dt.Ticks, false);
_output.Write(b, 0, b.Length);
}
|
|
|
|

|
Thanks cqwydz!
It was a failure on my part to deserialize from UTC time, I will update soon.
Its the man, not the machine - Chuck Yeager
If at first you don't succeed... get a better publicist
If the final destination is death, then we should enjoy every second of the journey.
|
|
|
|

|
if Array.Lenght = 0 then data parse is bad
private ArrayList ParseArray()
{
ArrayList array = new ArrayList();
bool breakparse = false;
while (!breakparse)
{
object o = ParseValue(out breakparse);
if (breakparse == false)
{
array.Add(o);
}
byte t = GetToken();
if (t == TOKENS.COMMA)
continue;
if (t == TOKENS.ARRAY_END)
break;
}
return array;
}
|
|
|
|

|
if Array is Empty
object o = ParseValue(out breakparse);
o == 4,
byte t = GetToken();
t = 2 can't break while
|
|
|
|

|
Please supply the code for the object you are trying to serialize and you get this error.
Its the man, not the machine - Chuck Yeager
If at first you don't succeed... get a better publicist
If the final destination is death, then we should enjoy every second of the journey.
|
|
|
|

|
public class Test
{
public string Name { get; set; }
public Test2 Test2 { get; set; }
}
public class Test2
{
public string Name { get; set; }
public int Age { get; set; }
public List List { get; set; }
}
var tt = new Test();
tt.Name = "tt";
tt.Test2 = new Test2();
tt.Test2.Name = "tt2";
tt.Test2.List = new List();
var bc = fastBinaryJSON.BJSON.Instance.ToJSON(tt);
var cb = fastBinaryJSON.BJSON.Instance.ToObject(bc);
|
|
|
|

|
Thanks, I will check it out.
Its the man, not the machine - Chuck Yeager
If at first you don't succeed... get a better publicist
If the final destination is death, then we should enjoy every second of the journey.
|
|
|
|

|
congrats to this great format
are any plans to have a JavaScript library to consume fastBinaryJSON directly?
|
|
|
|

|
As far as I know JSON (text version) is a first class citizen in javascript, so it would be easier to use that as javascript already understands and converts "types" as needed.
fastBinaryJSON is mostly intended for compiled languages with types which get lost in the conversion process.
So the answer would be no ( although it is mostly out of my league as I am not a web developer).
Its the man, not the machine - Chuck Yeager
If at first you don't succeed... get a better publicist
If the final destination is death, then we should enjoy every second of the journey.
|
|
|
|

|
unfortunately JsonH https://github.com/WebReflection/JSONH[^] or something similar are not widely supported.
because I am not a web developer either, I will wait and see, seems to me the next logical step in JavaScript.
|
|
|
|

|
Hi, does it support IDictionary?
Regards,
unruledboy_at_gmail_dot_com
http://www.xnlab.com
|
|
|
|

|
fastBinaryJSON supports all of what fastJSON supports, so yes it does handle the IDictionary interface.
If you find any problems, please let me know.
Its the man, not the machine - Chuck Yeager
If at first you don't succeed... get a better publicist
If the final destination is death, then we should enjoy every second of the journey.
|
|
|
|

|
IDictionary<string, object> dd = new Dictionary<string, object>();
dd.Add("hello", new class1("asda", "asdas", Guid.NewGuid()));
var rr = fastBinaryJSON.BJSON.Instance.ToJSON(dd);
var res = fastBinaryJSON.BJSON.Instance.ToObject<Dictionary<string, object>>(rr); var res = fastBinaryJSON.BJSON.Instance.ToObject<IDictionary<string, object>>(rr);
Regards,
unruledboy_at_gmail_dot_com
http://www.xnlab.com
|
|
|
|

|
Lost in translation...
Its the man, not the machine - Chuck Yeager
If at first you don't succeed... get a better publicist
If the final destination is death, then we should enjoy every second of the journey.
|
|
|
|

|
sorry, back to life now please have a look
Regards,
unruledboy_at_gmail_dot_com
http://www.xnlab.com
|
|
|
|

|
IDictionary is really an interface to something concrete.
So you can't really create an interface in the air, it must be bound to an actual class.
Hope that helps.
Its the man, not the machine - Chuck Yeager
If at first you don't succeed... get a better publicist
If the final destination is death, then we should enjoy every second of the journey.
|
|
|
|

|
Hi, that does make sense. However, Json.net does support it
Regards,
unruledboy_at_gmail_dot_com
http://www.xnlab.com
|
|
|
|

|
Json.net is probably creating the underlying class for you.
Its the man, not the machine - Chuck Yeager
If at first you don't succeed... get a better publicist
If the final destination is death, then we should enjoy every second of the journey.
|
|
|
|

|
Or perhaps just substituting System.Collections.Generic.Dictionary instead
|
|
|
|

|
Its the man, not the machine - Chuck Yeager
If at first you don't succeed... get a better publicist
If the final destination is death, then we should enjoy every second of the journey.
|
|
|
|

|
Have you considered combining the two projects into one with pluggable 'storage backend', so to speak?
|
|
|
|

|
Thanks Anton,
Yes and no.
While bundling them both together would make a lot of sense and I am using them both, I doubt that most people would care for the binary part and a lot of fastJSON's appeal is the fact that it is so tiny in comparison to other implementations.
Currently fastBinaryJSON is non standard (my own invention, although I don't know why someone didn't do this before), so time will tell...
Its the man, not the machine - Chuck Yeager
If at first you don't succeed... get a better publicist
If the final destination is death, then we should enjoy every second of the journey.
|
|
|
|

|
Totally valid points. But I didn't quite mean to bundle them together. I haven't yet had a look at the fastBJ code, but I image that the general layout is the same as in fastJ, with only the actual writing (and reading) being different. So why not abstract the reading/writing into an interface, IReaderWriter, and inherit two classes from that interface: JsonReaderWriter, and BJsonReaderWriter. Then, you could do things such as:
var o = fastJson.Instance<JsonReaderWriter>.ToObject<MyObjectType>(responseFromSomeService);
var bData = fastJson.Instance<BJsonReaderWriter>.ToJSON( o );
as an aside: JsonReaderWriter and BJsonReaderWriter could, theoretically, also be substituted for other, custom built types, althought THAT is something I seriously doubt.
This way, you can split the core of this thing into a separate assembly, and the different IReaderWriter's can be referenced by the developer using fastJson as needed.
I might get around to trying this out at some point myself, as it seems like an interesting idea to me, and I'd love to hear any input you may have.
![Badger | [badger,badger,badger,badger...]](/script/Forums/Images/badger.gif) "impossible" is just an opinion.
|
|
|
|

|
Good idea, this will require a lot of refactoring in the code.
One problem is that you would not be able to unify the external interfaces as of outputs strings and the other byte arrays.
Its the man, not the machine - Chuck Yeager
If at first you don't succeed... get a better publicist
If the final destination is death, then we should enjoy every second of the journey.
|
|
|
|

|
silverlight unsafe can't compile
|
|
|
|

|
Yes, thanks, the silverlight project is from fastJSON and I haven't tested it yet ( $types needs to be fixed )
I will post an update soon.
Its the man, not the machine - Chuck Yeager
If at first you don't succeed... get a better publicist
If the final destination is death, then we should enjoy every second of the journey.
|
|
|
|

|
use BitConverter work good.
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
|
A binary JSON serializer based on fastJSON (support for MonoDroid)
| Type | Article |
| Licence | CPOL |
| First Posted | 24 Mar 2012 |
| Views | 30,342 |
| Downloads | 1,290 |
| Bookmarked | 59 times |
|
|