Skip to content

Error on parsing Float #31

@KanedaFr

Description

@KanedaFr

exception on parsing a float value.
since float use "," also the key:value separator

to fix (sorry, I don't know how to make a PR)
replace

if (inSymbol){
	if(c==' ' || c=="\n" || c=="\r" || c=="\t" || c==',' || c==":" || c=="}" || c=="]"){ //end of symbol, return it
		pos--;
		return symbol;
	}
	else{
		symbol+=c;
		continue;
	}

by

if (inSymbol){
	if(c==' ' || c=="\n" || c=="\r" || c=="\t" || c==":" || c=="}" || c=="]"){ //end of symbol, return it
		pos--;
		return symbol;
	}
	else if(c==","){
		//i doubt pos > json.length in this case
		var c2 = json.charAt(pos);
		if ((c2 >= '0') && (c2<= '9'))
		{
			symbol+=c;
			continue;
		}
		else 
		{
			//not in float
			pos--;
			return symbol;
		}
	}
	else{
		symbol+=c;
		continue;
	}

HTH

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions