TJSON icon indicating copy to clipboard operation
TJSON copied to clipboard

Error on parsing Float

Open KanedaFr opened this issue 5 years ago • 0 comments

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

KanedaFr avatar May 18 '20 23:05 KanedaFr