• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

DataFormat.Error: We found extra characters at the end of JSON input. Details: Value= Position=0|Power Query|Excel Forum|My Online Training Hub

You are here: Home / DataFormat.Error: We found extra characters at the end of JSON input. Details: Value= Position=0|Power Query|Excel Forum|My Online Training Hub
Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumPower QueryDataFormat.Error: We found extra ch…
sp_PrintTopic sp_TopicIcon
DataFormat.Error: We found extra characters at the end of JSON input. Details: Value= Position=0
Avatar
Praveen N

New Member
Members
Level 0
Forum Posts: 2
Member Since:
June 25, 2020
sp_UserOfflineSmall Offline
1
June 25, 2020 - 7:42 am
sp_Permalink sp_Print

Hi,

I am user of Excel Office 365 and trying to fetch data from web (https://www.nseindia.com/marke.....ity-market) into Excel but getting an error message as below:

DataFormat.Error: We found extra characters at the end of JSON input.
Details:
Value=
Position=0

 

Details in Advanced Query Editor:

let
cookiestr = "A59DDA7465F61E5B5D6572B0BC35ED8A~Z8KhB7i06Ldraa+wZi4WKHL38yNyo2/U/DP8Vi/LZwpWltUEK3I3PVk0gQCu50XthqIMb9J1XyEVRdByJgR2A3/vmKw0AbYwMvaUARaR9eQVopbGYQQaLputuVdZGQaZAebPIdCNO7mLuWiVf8t1qBDy8MglhWdUxZfNYMNFF18=",

Source = Json.Document(Web.Contents("https://www.nseindia.com/market-data/live-equity-market",
[Headers = [#"accept-language"="en-US,en;q=0.9,ta;q=0.8,te;q=0.7", #"accept-encoding"="gzip, deflate", #"user-agent" = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36",
cookie = "cookiestr"]]))
in Source

Note: Cookie string value may need to be updated when you fetch the data in your machine.

 

Can anyone let me know what is the issue and how to rectify.

sp_AnswersTopicSeeAnswer See Answer
Avatar
Philip Treacy
Admin
Level 10
Forum Posts: 1512
Member Since:
October 5, 2010
sp_UserOfflineSmall Offline
2
June 25, 2020 - 8:49 am
sp_Permalink sp_Print sp_EditHistory

Hi Praveen,

The URL in your query responds with HTML not JSON so I get the error in PQ

DataSource.Error: The downloaded data is HTML, which isn't the expected type. The URL may be wrong or you might not have provided the right credentials to the server.

Please supply a file/query/URL that returns JSON.

If you have the URL that responds with JSON, you can enter this into your browser to see the data sent back.  You can then check that is valid JSON by using a site like https://jsonformatter.curiousc.....ncept.com/ 

Regards

Phil

sp_AnswersTopicAnswer
Answers Post
Avatar
Praveen N

New Member
Members
Level 0
Forum Posts: 2
Member Since:
June 25, 2020
sp_UserOfflineSmall Offline
3
June 25, 2020 - 3:02 pm
sp_Permalink sp_Print

Hi Phil,

Thank you for quick response and I missed to check if it is json or html (still learningEmbarassed).

As I am trying to connect to the URL: https://www.nseindia.com/marke.....ity-market from Excel Get Data from Web option, its throwing an error stating "Unable to Connect - We encountered an error while trying to connect. Details: "The underlying connection was closed. An unexpected error occurred on a receive" (Attached snapshots for reference)

 

Note: URL does not require any credentials as it is public accessible data.

Regards,

Praveen

Avatar
Philip Treacy
Admin
Level 10
Forum Posts: 1512
Member Since:
October 5, 2010
sp_UserOfflineSmall Offline
4
June 25, 2020 - 8:16 pm
sp_Permalink sp_Print

Hi Praveen,

Looking at the website in my browser, I can see that it periodically sends new information to the browser.  I suspect what is happening is that Power Query sits waiting for these updates to finish before loading, but the updates are continuous - so Power Query times out.

You can use Web.BrowserContents to load the web page and force PQ to load the page after a set amount of time.  In this example I've set it to 10 seconds.

let
Source = Web.Page( Web.BrowserContents("https://www.nseindia.com/market-data/live-equity-market", [WaitFor = [Timeout = #duration(0,0,0,10)]]))
in
Source

You'll need to use Power BI Desktop to load this query, unless your Excel Power Query supports Web.BrowserContents - mine does not at this point in time.  Excel PQ is not updated as regularly as PBI Desktop, even though Web.BrowserContents has been around for at least 5 months.

Regards

Phil

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: baber Tufail
Guest(s) 10
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 870
Purfleet: 412
Frans Visser: 346
David_Ng: 306
lea cohen: 219
A.Maurizio: 202
Jessica Stewart: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
drsven
Annie Witbrod
wahab tunde
Cong Le Duc
Faisal Bashir
Ivica Cvetkovski
Blaine Cox
Shankar Srinivasan
riyepa fdgf
Hannah Cave
Forum Stats:
Groups: 3
Forums: 24
Topics: 6205
Posts: 27211

 

Member Stats:
Guest Posters: 49
Members: 31880
Moderators: 3
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.