GithubHelp home page GithubHelp logo

dson's People

Contributors

deadalnix avatar john-colvin avatar uplinkcoder avatar w0rp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

dson's Issues

bug with float handling

Hi,

I've found a little bug with float handling.

Try :

auto objet = jsonObject();
objet["valeur"] = 1.001;
writeln(objet); // shows 1.001
auto objet2 = parseJSON(toJSON(object));
writeln(objet2); // shows 1.1

this could be corrected with something like :

JSON parseNumber() {
        enum byte NEGATIVE = 1;
        enum byte EXP_NEGATIVE = 2;

        long integer   = 0;
        long remainder = 0;
        short exponent = 0;
        byte signInfo  = 0;
        int tailleReste = -1;

        // Accumulate digits reading left-to-right in a number.
        void parseDigits(T)(ref T accum) {
            while (!empty()) {
                switch(front()) {
                case '0': .. case '9':
                    accum = cast(T) (accum * 10 + (moveFront() - '0'));
                    tailleReste++;
                    if (accum < 0) {
                        throw complaint("overflow error!");
                    }
                break;
                default:
                    return;
                }
            }
        }

        ...

        if (remainder != 0) {
                // Add in the remainder.
                if (whole==0) {
                   tailleReste++;
                }
                whole += remainder / (10.0 ^^ tailleReste);
        }

question about uppercase accentuated letters

Hi,
I don't know if it's a bug, or if i have done something wrong.

I've try the following code :

auto objet = jsonObject();
objet["valeur"] = "é".toUpper();
writeln(objet);
auto js = toJSON(objet);
writeln(js);
auto objet2 = parseJSON(js);
writeln(objet2);

and it gives me :

["valeur":É]
{"valeur":"\u0089"}
["valeur":�]

It seems the É isn't properly converted.
There is no trouble with lowercase accentuated letters, only with uppercase accentuated letters.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.