• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Reply to: Jison Spec

Collapse

You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:

  • You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
  • You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
  • If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.

Previously on "Jison Spec"

Collapse

  • woohoo
    replied
    Originally posted by WTFH View Post
    Yup, thanks for providing the link.

    Leave a comment:


  • WTFH
    replied
    Originally posted by woohoo View Post
    Looking at the op spelling etc, i reckon I've wasted time on a troll. But reading your post has made my efforts worthwhile.
    You wasted time on a troll.

    https://www.contractoruk.com/forums/...ml#post2587674

    Leave a comment:


  • woohoo
    replied
    Originally posted by northernladuk View Post
    These coding threads always give me a lazy lob on. Even better than threads with numbers in the Accounting Section, although they never end well.
    Looking at the op spelling etc, i reckon I've wasted time on a troll. But reading your post has made my efforts worthwhile.

    Leave a comment:


  • northernladuk
    replied
    These coding threads always give me a lazy lob on. Even better than threads with numbers in the Accounting Section, although they never end well.

    Leave a comment:


  • The James Room
    replied
    Originally posted by woohoo View Post
    If you are using ASP.NET Core MVC and you have this in the Startup.cs then it will convert your property names to company_name. Just remove it and it should default to camel case. I don't think its the default, so you may have added it? Don't know without seeing the code what you have.

    Code:
        services.AddMvc().AddJsonOptions(o =>
        {
            o.SerializerSettings.ContractResolver = new DefaultContractResolver()
            {
                NamingStrategy = new SnakeCaseNamingStrategy()
            };
        });
    Amizing!

    Leave a comment:


  • woohoo
    replied
    Originally posted by The James Room View Post
    Bisically:

    public IActionResult GetCompanies()
    {
    return Json(this._service.GetCompanies());
    }
    If you are using ASP.NET Core MVC and you have this in the Startup.cs then it will convert your property names to company_name. Just remove it and it should default to camel case. I don't think its the default, so you may have added it? Don't know without seeing the code that you have.

    Code:
        services.AddMvc().AddJsonOptions(o =>
        {
            o.SerializerSettings.ContractResolver = new DefaultContractResolver()
            {
                NamingStrategy = new SnakeCaseNamingStrategy()
            };
        });
    Last edited by woohoo; 26 September 2018, 06:24.

    Leave a comment:


  • The James Room
    replied
    Originally posted by woohoo View Post
    Show me the codez.
    Bisically:

    public IActionResult GetCompanies()
    {
    return Json(this._service.GetCompanies());
    }

    Leave a comment:


  • woohoo
    replied
    Originally posted by The James Room View Post
    There isn't any. I wrote it.

    Perhaps this is the way that .net API serialises Jison.
    Show me the codez.

    Leave a comment:


  • The James Room
    replied
    Originally posted by woohoo View Post
    So I dont know why a web service would expect CompanyCode and return Company_code. I don't think there is consistent approach to json property names but I would expect the input and output to be the same.

    What does the web service documentation say?
    There isn't any. I wrote it.

    Perhaps this is the way that .net API serialises Jison.

    Leave a comment:


  • woohoo
    replied
    Originally posted by The James Room View Post
    Any of you keyboard kids tell me why the returned JISON from a web service captilises and adds underscores to variable names?

    So CompanyCode in my server code becomes companY_CODE in the JISON.

    I Feel like I need a crystal ball.
    So I dont know why a web service would expect CompanyCode and return Company_code. I don't think there is consistent approach to json property names but I would expect the input and output to be the same.

    What does the web service documentation say?

    Leave a comment:


  • administrator
    replied
    Originally posted by Zigenare View Post
    Nope, but I can recommend you post this in the "Technical" section - or suffer the consequences, you clueless twat!
    Thread moved - back in your crate, hound.

    Leave a comment:


  • The James Room
    replied
    Originally posted by Zigenare View Post
    Nope, but I can recommend you post this in the "Technical" section - or suffer the consequences, you clueless twat!
    Easy soldier - I didnt't realise there was a technical Subby.

    Leave a comment:


  • Zigenare
    replied
    Originally posted by The James Room View Post
    Any of you keyboard kids tell me why the returned JISON from a web service captilises and adds underscores to variable names?

    So CompanyCode in my server code becomes companY_CODE in the JISON.

    I Feel like I need a crystal ball.
    Nope, but I can recommend you post this in the "Technical" section - or suffer the consequences, you clueless twat!

    Leave a comment:


  • The James Room
    started a topic Jison Spec

    Jison Spec

    Any of you keyboard kids tell me why the returned JISON from a web service captilises and adds underscores to variable names?

    So CompanyCode in my server code becomes companY_CODE in the JISON.

    I Feel like I need a crystal ball.
Working...
X