Hey,

I'm trying to get a string interpolated. There are two values which have string 
type and I'm trying to do interpolation with % operator:
    
    
    import json
    import strutils
    
    var
        configFile: JsonNode = parseFile("settings.json")
        API_KEY: string = $(configFile["api_key"])
        CITY: string = $(configFile["city"])
        BASE_URL: string = "http://api.apixu.com/v1/current.json?key=$1&q=$2"; % 
[API_KEY, CITY]
    
    

But when I do:
    
    
    echo BASE_URL
    

I get my string shown as below:
    
    
    http://api.apixu.com/v1/current.json?key="abcdef12345"&q="Gomel";
    

So you can see those " " around inserted parts. So my question is how to get 
rid of them and what was I doing wrong?

P.S. My JSON file looks like that:
    
    
    {
        "api_key": "abcdef12345",
        "city":    "Gomel"
    }
    

Reply via email to