Why isn't client.readStringUntil("]") working as expected?

Why isn't client.readStringUntil("]") working as expected in my sketch when client.findUntil("[","\n") is?

The data stream that I'm capturing as displayed by a Firefox call to the site is:

{"method":"uploadsn","version":"Solax_SI_CH_2nd_20160810_DE03","type":"AL_SE","SN":"626F832D","Data":[1.7,1.7,208.5,207.3,1.2,248.9,220,35,1.7,6924.6,-22,354,352,49.67,9.58,476,24,53,0.0,2381.9,,,,,,,,,,,,,,,,,,,,,,0.00,0.00,,,,,,,,50.02,,,0.0,0.0,0,0.00,0,0,0,0.00,0,8,0,0,0.00,0,8],"Status":"2"}

The only part that I am interested in is between the square brackets. So my code snippet for extracting that is:

void GetSolaXData()
{
  String realTimeData;
  char startOfData = "[";
  char endOfData = "]";
  Serial.println("Attempting to connect to SolaX Local");
  if (client.connect(SolaX_IP, 80))
  {
    Serial.print("Connected to ");
    Serial.println(client.remoteIP());
    client.println("GET /api/realTimeData.html HTTP/1.1");
    client.println();
    Serial.println("GET request issued.");
    Serial.println("Waiting for client to become available:-");
    while (client.connected())
    {
      Serial.print(".");
      if (client.available())
      {
        if (client.findUntil("[","\n"))
        {
          realTimeData = client.readStringUntil("]");
          Serial.println();
          Serial.println(realTimeData);
        }
      }
    }
    client.stop();
  }
  else
  {
    Serial.println("Client disconnected.");
    client.stop();
  }
}

Rather than post the whole sketch I've only posted the part that is pertinent to my question. The network access part is working just fine.

The Arduino IDE Monitor output from running the sketch is:

Connected to Network with IP Address 192.168.1.195
Attempting to connect to SolaX Local
Connected to 192.168.1.101
GET request issued.
Waiting for client to become available:-
...
1.7,1.8,210.0,209.1,1.1,249.6,196,36,1.7,6924.6,-39,357,376,49.70,10.39,517,24,54,0.0,2381.9,,,,,,,,,,,,,,,,,,,,,,0.00,0.00,,,,,,,,49.99,,,0.0,0.0,0,0.00,0,0,0,0.00,0,8,0,0,0.00,0,8],"Status":"2"}

Observation; the line of full stops drawn whist waiting and the API return are continuous in the monitor. Carrige return/Line Feeds have been arbritrarily added to the API return, and the line of full stops removed by the Forum entry window.

As you can see, the client.findUntil statement is successfully stripping off the string up to and including "[". But you can see also that the content of the variable realTimeData as printed goes beyond the "]" character specified. Why doesn't my statement

realTimeData = client.readStringUntil("]");

work as expected? I'm clearly missing/misunderstanding something.

As my next task is to count commas to locate the data elements that I need to extract, I thought it wise first to find out what is going wrong with extraction of the required substring from the API data stream.

because the terminator must be char ']', not string "["

the format of the response is called JSON.
the ArduinoJson library can parse it

Thank you Juraj. You make two points that advanced my understanding. In the reference both find and read definitions state that the target is of type char, although I grant you the first says that it accepts a string with the target of type char. That subtlety was lost on me.

Secondly, I've been working with another website, Met Office Datapoint, that allows one to specify whether HTML or JSON to be provided. In the case of SolaX the call is /api/realTimeData.html which I assumed meant that the response would be HTML not JSON. In fact in the case of the met office site, FireFox presents the results quite differently depending upon which has been specified in the call. The reults from the call to SolaX resemble neither, and certainly look nothing like a call to the Met Office API specifying JSON, which gives me three tabbed windows, JSON, RAW, and Headers to choose from. You've seen the response to my call to SolaX with Firefox, which based upon that, clearly doesn't recognise it as JSON. Nevertheless, you clearly know a lot nore about this than I do, so I'll research the JSON Library.

it is
bool findUntil(char *target, char *terminator);
so string and string
but
String readStringUntil(char terminator);
so single char

the browser uses the Content-type header to know if it is JSON

Follow up: Having changed the " to ' in readStringUntil the sketch now does what I expected. However, the compiler continues to issue a warning:

GetSolaX-Data-01-2\GetSolaX-Data-01-2.ino:68:38: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]

if (client.findUntil("[","\n"))

I don't know what significance I should attach to this, or indeed what it means. I've been trying to find a reference source for what " ' * \ / mean/do in the context of string and character handling, but so far have found nothing. Book or web I don't mind, but a pointer would be good.

Oh and thanks for your latest which arived whilst typing. The fog is lifting! " for string ' for a single char. Check? And I'll look at the header.

Slow-Learner:
Follow up: Having changed the " to ' in readStringUntil the sketch now does what I expected. However, the compiler continues to issue a warning:

GetSolaX-Data-01-2\GetSolaX-Data-01-2.ino:68:38: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]

if (client.findUntil("[","\n"))

I don't know what significance I should attach to this, or indeed what it means. I've been trying to find a reference source for what " ' * \ / mean/do in the context of string and character handling, but so far have found nothing. Book or web I don't mind, but a pointer would be good.

Oh and thanks for your latest which arived whilst typing. The fog is lifting! " for string ' for a single char. Check? And I'll look at the header.

the findUntil function has the parameter as char*. but it should have const char* (it doesn't change the parameter). "[" is constant. the compiler for some boards is rigorous. use
client.find((char*) "[")

http://www.cplusplus.com/doc/tutorial/pointers/

\ is 'escape' character for special characters like the new line character. '\t' is a tab character

Arduino language is C++

Juraj:
the find function has the parameter as char*.

How is that connected to the invalid use of findUntil?

The captured string is stored in the first parameter, so
if (client.findUntil("[", "\n"))
is really strange.

Slow-Learner:
Follow up: Having changed the " to ' in readStringUntil the sketch now does what I expected. However, the compiler continues to issue a warning:

GetSolaX-Data-01-2\GetSolaX-Data-01-2.ino:68:38: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]

if (client.findUntil("[","\n"))

I don't know what significance I should attach to this, or indeed what it means. I've been trying to find a reference source for what " ' * \ / mean/do in the context of string and character handling, but so far have found nothing. Book or web I don't mind, but a pointer would be good.

Oh and thanks for your latest which arived whilst typing. The fog is lifting! " for string ' for a single char. Check? And I'll look at the header.

The header reports:

DHCP assigned IP 192.168.1.195
connecting to 192.168.1.101...
connected to 192.168.1.101
HTTP/1.1 200 OK
Server: MySocket Server
Date: TEST
Content-Type: text/html
Content-Length: 295
Connection: close
Accept-Ranges: bytes

Whandall:
How is that connected to the invalid use of findUntil?

The captured string is stored in the first parameter, so
if (client.findUntil("[", "\n"))
is really strange.

1 corrected
2 bool findUntil(char *target, char *terminator);
terminator to avoid timeout if the target is not found