Click here to Skip to main content
15,892,737 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I need generate information from "2015-07-20" without Meta date. I use JSON with c#.

Example:
{
    "Meta Data": {
        "1. Information": "Daily Prices (open, high, low, close) and volumes",
        "2. Symbol": "",
        "3. Last Refreshed": "2015-05-20",
        "4. Output Size": "Compact",
        "5. Time Zone": "US/Eastern"
    },
    "Time Series (Daily)": {
        "2015-05-20": {
            "1. open": "108",
            "2. high": "108",
            "3. low": "106.",
            "4. close": "106",
            "5. volume": "56038827"
        },
        "2015-05-19": {
            "1. open": "104",
            "2. high": "105",
            "3. low": "103",
            "4. close": "104",
            "5. v


j2sharp show me that I could use this:

public class MetaData
{
    public string __invalid_name__1. Information { get; set; }
    public string __invalid_name__2. Symbol { get; set; }
    public string __invalid_name__3. Last Refreshed { get; set; }
    public string __invalid_name__4. Output Size { get; set; }
    public string __invalid_name__5. Time Zone { get; set; }
}

public class __invalid_type__20180720
{
    public string __invalid_name__1. open { get; set; }
    public string __invalid_name__2. high { get; set; }
    public string __invalid_name__3. low { get; set; }
    public string __invalid_name__4. close { get; set; }
    public string __invalid_name__5. volume { get; set; }
}

public class __invalid_type__20180719
{
    public string __invalid_name__1. open { get; set; }
    public string __invalid_name__2. high { get; set; }
    public string __invalid_name__3. low { get; set; }
    public string __invalid_name__4. close { get; set; }
    public string __invalid_name__5. volume { get; set; }
}


What I have tried:

I triedJToken.SelectTokens from: Newtonsoft.Json.Linq.But I don't know how to properly use this.
Posted
Comments
F-ES Sitecore 24-Jul-18 8:49am    
If you're generating that JSON then generate JSON that is possible to deserialise. ie the names can be used as c# variables, so "Information" and "LastRefreshed" rather than "1. Information" and "3. Last Refreshed". It will make dealing with the data much easier.
ZurdoDev 25-Jul-18 12:59pm    
I do not understand your question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900